4,008
社区成员
发帖
与我相关
我的任务
分享
function remove(ar)
s1 = ","
For i=0 To UBound(ar)
If InStr(s1, "," & ar(i) & ",")=0 Then
s1 = s1 & ar(i) & ","
End If
Next
remove = Split(Mid(s1,2,Len(s1)-2),",")
end Function
Dim a(4)
a(0)="1"
a(1)="1"
a(2)="2"
a(3)="1"
a(4)="111"
b = remove(a)
MsgBox Join(b, ",")
arr= Array(1,3,4,4,6,3,2,3,1)
WScript.Echo Join(distinct(arr), ",")
Function distinct(arr)
Dim dic, i
Set dic = CreateObject("Scripting.Dictionary")
For i = 0 To UBound(arr)
If Not dic.Exists("k_" & Cstr(arr(i))) Then
dic.Add "k_" & Cstr(arr(i)), arr(i)
End If
Next
distinct = dic.Items()
End Function