如何去除数组中的重复元素?谁能用VBS写个函数,谢谢
------解决方案--------------------------------------------------------
- VBScript code
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