今天有人在CSDN提问:
abc,123,aac,abc,aac,1234
如何把上边的字符串去掉重复的部分,变成
abc,123,aac,1234
解决方法如下:
<%
str="abc;123;aac;abc;1234;123;"
arrayList=split(str,";")
For i=0 To Ubound(arrayList)
If InStr(str,arrayList(i))<>InstrRev(str,arrayList(i)) Then
If InStr(NewStr,","&arrayList(i)&"")<1 Then NewStr=NewStr&","&arrayList(i)
Else
NewStr=NewStr&","&arrayList(i)
End If
Next
If Left(NewStr,1)="," Then NewStr=Right(NewStr,Len(NewStr)-1)
Response.Write NewStr
%>