Código fuente de 'Ordena array 4.asp'
<html>
<head>
<title>Ordena array 4 - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<p align="center"><b><font size="3">Ordena array 4</font></b>
<body style="font-family: Arial; font-size: 11pt"></p>
<b>Vector:</b><br>1,5,"hola","valencia","astalaweb",123,12,98<br><br>
<b>Vector ordenado:<br></b>
<%
Dim MyArray
MyArray = Array(1,5,"hola","valencia","astalaweb",123,12,98)
MyArray = OrdenaVector(MyArray)
For I = 0 to Ubound(MyArray)
if i<Ubound(MyArray) then
Response.Write MyArray(I) & "," & vbCRLF
else
Response.Write MyArray(I)
end if
Next
Response.End
'*** OrdenaVectorer Function that takes an array and OrdenaVectors it
Function OrdenaVector(ary)
KeepChecking = TRUE
Do Until KeepChecking = FALSE
KeepChecking = FALSE
For I = 0 to UBound(ary)
If I = UBound(ary) Then Exit For
If ary(I) > ary(I+1) Then
FirstValue = ary(I)
SecondValue = ary(I+1)
ary(I) = SecondValue
ary(I+1) = FirstValue
KeepChecking = TRUE
End If
Next
Loop
OrdenaVector = ary
End Function
%>
</body>
</html>