Searched online Code The same is true.
Function sort (ary)
Dim keepchecking, I, firstvalue, secondvalue
Keepchecking = true
Do until keepchecking = false
Keepchecking = false
For I = 0 to ubound (ary)
If I = ubound (ary) Then exit
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
Sort = ary
End Function
Error ......
Test it.
S = "11,3, 1"
S = sort (split (S ,","))
For I = 0 to ubound (s)
Response. Write S (I) & "<br>"
Next
The printed result is
1
11
3
The correct function is:
Function sort (ary)
Ck = true
Do until ck = false
Ck = false
For f = 0 to ubound (ary)-1
If clng (ary (F)> clng (ary (F + 1) then
V1 = clng (ary (f ))
V2 = clng (ary (F + 1 ))
Ary (f) = v2
Ary (F + 1) = V1
Ck = true
End if
Next
Loop
Sort = ary
End Function
The difference is in a clng ()
But it is funny that some Arrays can be correctly arranged using the wrong sort function.