| Sort and array: ascending or descending order |
In this examples we will show how to order values in a array.
The only diference between arrays bellow is indicated in bold:
Scripts will work both for numbers or string.
Sort: Ascending
| <%
MyArray=Array(25,14,20,45,25,4,1,31,22,7) max=ubound(MyArray) For i=0 to max
Response.write ("The sorted values are those ones: <BR>") For i=0 to max
|
The sorted values are these ones:
1 4 7 14 20 22 25 25 31 45 |
Sort: Descending
| <%
MyArray=Array("John","Peter","Anna","Alberto","George","Unai") max=ubound(MyArray) For i=0 to max
Response.write ("The sorted values are these ones: <BR>") For i=0 to max
|
The sorted values are these ones:
Unai Peter John George Anna Alberto |