Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - Write vb script code to delete the duplicate values in an array?




261
views
asked marvit August 20, 2014 03:01 AM  

Write vb script code to delete the duplicate values in an array?


           

1 Answers



 
answered By Dharma   0  
Set objDictionary = CreateObject("Scripting.Dictionary")

arrItems = Array("a","b","b","c","c","c","d","e","e","e")

For Each strItem in arrItems
  If Not objDictionary.Exists(strItem) Then
    objDictionary.Add strItem, strItem  
  End If
Next

intItems = objDictionary.Count - 1

ReDim arrItems(intItems)

i = 0

For Each strKey in objDictionary.Keys
  arrItems(i) = strKey
  i = i + 1
Next

For Each strItem in arrItems
  Wscript.Echo strItem
Next
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert