<dfn id="w48us"></dfn><ul id="w48us"></ul>
  • <ul id="w48us"></ul>
  • <del id="w48us"></del>
    <ul id="w48us"></ul>
  • asp數組重復刪除函數

    時間:2024-09-01 15:13:48 ASP 我要投稿
    • 相關推薦

    asp數組重復刪除函數

      因為要寫個東西用到,所以百度了一下,居然有朋友亂寫,而且比較多,都沒有認真測試過,只對字符可以,但是對數字就不可以,而且通用性很差,需要修改才可以真正使用。沒辦法就自己寫了,經過測試完全沒有問題,而且思路很方便,代碼很短,如下:

      復制代碼 代碼如下:

      <%

      function cxarraynull(cxstr1,cxstr2)

      if isarray(cxstr1) then

      cxarraynull = "對不起,參數1不能為數組"

      Exit Function

      end if

      if cxstr1 = "" or isempty(cxstr1) then

      cxarraynull = "nodate"

      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

      cxarraynull = right(sss,len(sss) - len(cxstr2))

      cxarraynull = left(cxarraynull,len(cxarraynull) - len(cxstr2))

      end Function

      %>

      使用方法和函數表示:

      1、cxarraynull(cxstr1,cxstr2)函數中的兩個參數:

      cxstr1:要檢測的數組變量,可以為空,或其它未知的錯誤數據,當為空或則為錯誤數據返回"nodate"。

      cxstr2:數組的分割符號,可以為空,或為chr(13)等,自動替換輸出。

      2、測試代碼:

      <%

      s="1,2,3,4,2,3,5,3"

      s=cxarraynull(s,",")

      response.write s

      %>

      輸出:1,2,3,4,5

      增強版本,解決了數組中最后一位的,逗號問題。

      復制代碼 代碼如下:

      <%

      function cxarraynull(cxstr1,cxstr2)

      if isarray(cxstr1) then

      cxarraynull = "對不起,參數1不能為數組"

      Exit Function

      end if

      if cxstr1 = "" or isempty(cxstr1) then

      cxarraynull = "nodate"

      Exit Function

      end if

      do while instr(cxstr1,",,")>0

      cxstr1=replace(cxstr1,",,",",")

      loop

      if right(cxstr1,1)="," then

      cxstr1=left(cxstr1,len(cxstr1)-1)

      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

      cxarraynull = right(sss,len(sss) - len(cxstr2))

      cxarraynull = left(cxarraynull,len(cxarraynull) - len(cxstr2))

      end function

      %>

      測試代碼:

      復制代碼 代碼如下:

      s="1,2,3,4,55,55,55,333,333,2,3,5,3,88,,,,,,,66,,66,,,,,,,,,,,,,,,,,,,,,,,,"

      s=cxarraynull(s,",")

      response.write s

    【asp數組重復刪除函數】相關文章:

    php數組函數序列之array-combine() - 數組合并函數的代碼08-25

    關于asp 的常用函數用法10-11

    解讀Rnd 函數中的asp08-03

    ASP.NET Page函數調用解析10-01

    防盜鏈接ASP函數實現代碼01-23

    JavaScript數組常用方法介紹09-04

    Excel高手武器:數組基礎08-08

    word批注刪除方法10-03

    ASP提速技巧08-05

    重復法翻譯09-12

    主站蜘蛛池模板: 久久精品国产亚洲77777| 国产亚洲精品无码成人| 无码精品A∨在线观看| 99热亚洲精品6码| 国产精品五月天强力打造| 日韩精品人妻av一区二区三区 | 四虎精品成人免费永久| 一本大道无码日韩精品影视| 大胸国产精品视频| 国产精品日本欧美一区二区| 亚洲av无码乱码国产精品fc2| 精品91自产拍在线观看| 麻豆精品久久精品色综合| 精品久久久久久无码专区| 亚洲人成国产精品无码| 久久精品夜色噜噜亚洲A∨| 国产成人精品免费大全| 国产精品一级片| 国产精品水嫩水嫩| 久久久久人妻一区精品色| 亚洲性日韩精品国产一区二区 | 国产成人精品日本亚洲专一区| 日韩精品无码久久久久久 | 欧美精品一区二区在线精品 | 99久久精品免费观看国产| 久久久久久久99精品免费观看| 91老司机深夜福利精品视频在线观看 | 亚洲综合无码精品一区二区三区| 欧美午夜精品久久久久久浪潮| 久久国产午夜精品一区二区三区| 国产精品v欧美精品v日韩| 亚洲精品高清国产一久久| 国产人成精品午夜在线观看| 亚洲精品高清无码视频| 亚洲色精品aⅴ一区区三区| 无码精品人妻一区二区三区影院| 国产小呦泬泬99精品| 国产成人精品cao在线| 91午夜精品亚洲一区二区三区 | 国产精品内射久久久久欢欢| 久久福利青草精品资源站|