第一个方法:
function getStr(str)
strArr=split(str,",")
newstr=","
for i=0 to ubound(strArr)
newstr=replace(newstr, ","&strArr(i)&"," , ",")
newstr=newstr&strArr(i)&","
next
newstr=replace("#"&newstr,"#,","")
getStr=replace(newstr&"#",",#","")
end function
第二个方法:
Function FormateOrderBy(OrderByText)
Dim tmp,tmp2,i,j
tmp = Split(OrderByText,",")
For i=0 To Ubound(tmp)-1
For j=i+1 To Ubound(tmp)
If UCase(Trim(tmp(i)))=UCase(Trim(tmp(j))) Then
tmp(j)=""
End If
Next
Next
tmp2=""
For i=0 To Ubound(tmp)
If tmp(i) <>"" Then tmp2 = tmp2 & tmp(i) & ","
Next
FormateOrderBy = Left(tmp2,Len(tmp2)-1)
End Function
Dim dic, arr, ptr
arr = split("4,14,15,15,6,6,11,11", ",")
Set dic = Server.CreateObject("Scripting.Dictionary")
For Each ptr In arr
dic(ptr) = ptr
Next
arr = dic.items
Response.Write Join(arr, ",")