数组去重复[vbs]


Function quchongfu(srcstr,ig,sp)
 Dim objDict,x,y
 srcarr=split(Trim(srcstr),sp)
 Set objDict=createobject("Scripting.Dictionary")
 For Each x In srcArr
  If x<>"" Then
   If ig=True  Then
    y=LCase(x)
   Else
    y=x
   End If
   If Not objDict.Exists(y) Then objDict.Add x,y
  End If
 Next
 x=Join(objDict.Items,sp)
 If Right(x,1)=sp Then
  quchongfu=left(x,Len(x)-1)
 Else
  quchongfu=x
 End If
 Set objDict=Nothing
End Function
 
MsgBox quchongfu("aaa,sss,,,AAA,ccc,aaa,AAA,ZZZ,ssssss,,",true,",")

posted on 2013-04-21 19:07  巍 巍  阅读(430)  评论(0编辑  收藏  举报

导航