麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 語言 > JavaScript > 正文

ASP 過濾數組重復數據函數(加強版)

2024-05-06 14:09:49
字體:
來源:轉載
供稿:網友
函數代碼:
代碼如下:
<%'*******************************************************
'過濾數組重復函數名稱:array_no(cxstr1,cxstr2,cxstr3)
'cxstr1:任意的字符串,自動識別
'cxstr2:cxstr1中分割符號。
'cxstr3:提取結果中的某一位置字串,等于0時返回為全部,大于數組下標時返回最后.
'使用于二維數組
'*******************************************************
function array_no(cxstr1,cxstr2,cxstr3)
if len(cxstr3) > 0 then
if not IsNumeric(cxstr3) then
array_no = "對不起,參數3類型必需為數字"
Exit Function
end if
else
array_no = "對不起,參數3類型必需為數字"
Exit Function
end if
if isarray(cxstr1) then
array_no = "對不起,參數1不能為數組"
Exit Function
end if
if cxstr1 = "" or isempty(cxstr1) then
array_no = "沒有數據"
Exit Function
end if
ss = split(cxstr1,cxstr2)
cxs=cxstr2&ss(0)&cxstr2
sss=cxs
for m = 0 to ubound(ss)
cc = cxstr2&ss(m)&cxstr2
if instr(sss,cc)=0 then
sss = sss&ss(m)&cxstr2
end if
next
array_no = right(sss,len(sss)-len(cxstr2))
array_no = left(array_no,len(array_no)-len(cxstr2))
if cxstr3 <> 0 then
cx_sp = split(array_no,cxstr2)
if cxstr3 > ubound(cx_sp) then
array_no = cx_sp(ubound(cx_sp))
else
array_no = cx_sp(cxstr3)
end if
end if
end function%>


下面是測試代碼:
代碼如下:
<%s1 = "abc,aa,bb,cdef,bc,abcdef,hhgg,gggg,cde,edc"
s2 = "1,2,3,11,22,33,12,13,14,11,33,333,14"
s3 = ""
s4 = "sdf,abc,12,2,2,abc"
s5 = split(s4)
response.write "字串為字符時:"&array_no(s1,",",0)&"<br>"
response.write "字串為數字時:"&array_no(s2,",",0)&"<br>"
response.write "字串為空時:"&array_no(s3,",",0)&"<br>"
response.write "字串為混合時:"&array_no(s4,",",0)&"<br>"
response.write "字串為數組時:"&array_no(s5,",",0)&"<br>"
response.write "字串為未知變量時:"&array_no(s33,",",0)&"<br>"
response.write "提取某一位時,沒有超過下標時:"&array_no(s1,",",2)&"<br>"
response.write "提取某一位時,超過下標時:"&array_no(s1,",",200)&"<br>"%>

測試結果:
代碼如下:
字串為字符時:abc,aa,bb,cdef,bc,abcdef,hhgg,gggg,cde,edc
字串為數字時:1,2,3,11,22,33,12,13,14,333
字串為空時:沒有數據
字串為混合時:sdf,abc,12,2
字串為數組時:對不起,參數1不能為數組
字串為未知變量時:沒有數據
提取某一位時,沒有超過下標時:bb
提取某一位時,超過下標時:edc


錯新站長站增強版本: 解決了數組常見錯誤
代碼如下:
<%
'*******************************************************
'過濾數組重復函數名稱:array_no(cxstr1,cxstr2,cxstr3)
'cxstr1:任意的字符串,自動識別
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 成人福利视频在线观看 | 性 毛片 | 日韩精品中文字幕一区二区三区 | 日韩视频一区二区 | 九九热精| 高潮娇喘嗯啊~文字 | 中文字幕在线观看免费视频 | 一级电影免费看 | 一本色道久久综合狠狠躁篇适合什么人看 | 久久成人国产精品 | 黄色片免费视频 | 国产成人精品二区 | 欧美无限资源 | xxxx欧美视频| 91精品国产一区二区三区四区在线 | 国产精品色在线网站 | 中文字幕在线观看视频一区 | 性高湖久久久久久久久aaaaa | 色视频一区二区 | 久草久视频 | 国产做爰全免费的视频黑人 | 国产精品免费大片 | 精品久久中文字幕 | av在线不卡免费 | 亚洲精品欧美二区三区中文字幕 | 欧美成人午夜精品久久久 | 91国内精品久久久久免费影院 | 国产精品视频yy9299一区 | 91成人久久 | 日韩黄色片免费看 | 久色亚洲 | 免费看成人毛片 | 黄色大片免费网站 | 欧美成人一区二区视频 | 91久久夜色精品国产网站 | 极品国产91在线网站 | 精品国产一区二区亚洲人成毛片 | av在线播放亚洲 | 男女羞羞视频在线免费观看 | 九九热免费视频在线观看 | 日本a大片|