Thursday, March 29, 2012

Find Unique Values in Array using VBScript

            ''*  Find the unique values from the Array
            Dim yourArray(), objDict, OutArray, i

            yourArray() = Array("val1", "val2", "valn")
            Set objDict = CreateObject("Scripting.Dictionary")
            objDict.CompareMode = vbTextCompare
            For each val in yourArray
                objDict(val) = val
            OutArray = objDict.Items
            i = 0
            For i = 0 to ubound(OutArray)
                print OutArray(i)

"A good threat is worth a thousand tests" - Boris Beizer

No comments: