Custom Search

Friday, March 2, 2012

Sorting an array with out using Sort method in vbscript/QTP

dim arrSortOut(8)
arrSortOut(0)="xCount"
arrSortOut(1)="zExec"
arrSortOut(2)="yFinance"
arrSortOut(3)="HR"
arrSortOut(4)="IT "
arrSortOut(5)="!aaaLegal"
arrSortOut(6)="Liberman"
arrSortOut(7)="Martha"
arrSortOut(8)="Regis"

for i = UBound(arrSortOut) - 1 To 0 Step -1
     for j= 0 to i
          if arrSortOut(j)>arrSortOut(j+1) then
             temp=arrSortOut(j+1)
             arrSortOut(j+1)=arrSortOut(j)
             arrSortOut(j)=temp
         end if
    next
next

for x=0 to 8
    print arrSortOut(x)
next

No comments:

Post a Comment

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