DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Vbscript Array Sort In Alphabetical Order

01.03.2007
| 41609 views |
  • submit to reddit
        // sort vbscript array

<%
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 x=0 to 8
response.write arrSortOut(x)&"<br>"
next

response.write "<br>"

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
response.write arrSortOut(x)&"<br>"
next

%>