精华区 [关闭][返回]

当前位置:月光软件>>讨论区精华>>〖软件开发〗>>● ASP>>★ASP的应用★>>  数组数据排序的程序例子

主题:  数组数据排序的程序例子
发信人: dalu_ok()
整理人: netyum(2002-07-23 19:00:44), 站内信件
数组数据排序的程序例子



<%
''*** build example array to show that this thing can sort
''*** alpha-numeric arrays
Dim MyArray
MyArray = Array(1,5,"shawn","says","hello"2m骺噃嶤123,12,98)
MyArray = Sort(MyArray)
For I = 0 to Ubound(MyArray)
Response.Write MyArray(I) & "<br>" & vbCRLF
Next
Response.End


''*** Sorter Function that takes an array and sorts it
Function Sort(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
Sort = ary
End Function
%>
 

----------------------------------------------------------------------
----------
 


--
※ 来源:.月光程序代码网 http://www.moon-soft.com.[FROM: 61.137.144.220]

[关闭][返回]






转载请注明:转载自 月光程序代码网 [ http://www.moon-soft.com ]