Custom Search

Friday, March 2, 2012

Sorting an array using Sort method in Vbscript/QTP

dim myArray(6)
myArray(0)= "New"
myArray(1)= "Old"
myArray(2)= "Add"
myArray(3)= "Create"
myArray(4)= "Insert"
myArray(5)= "Delete"

Set myArrayList= CreateObject( "System.Collections.ArrayList" )
For i=0 to Ubound(myArray)-1
myArrayList.Add myArray(i)
Next

Rem Sorting array list
myArrayList.sort

For i=0 to Ubound(myArray)-1
print myArrayList.item(i)
Next

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.