IT码农库

您当前所在位置:首页 > 网络编程 > ASP编程

ASP编程

asp数字或者字符排序函数代码

网络 2011-01-28ASP编程2998
asp排序没有系统函数直接支持,而我们经常需要使用的数字排序和字符排序、按拼音排序都离不开排序。
复制代码 代码如下:

'排序
Function Sort1(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 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
Sort1 = ary
End Function

Dim arr
arr = Array("a","c","b")
arr = Sort1(arr)
For i=0 to ubound(arr)
Response.Write(arr(i)&"<br />")
Next
大图广告(830*140)