<%
'=====================================
'作者:80端口,阿里西西
'时间:2005-12-23
'作用:对数据进行重新排序
'=====================================
Function NewOrder(sz)
Dim ali,icount,i,ii,j,itemp
ali=split(sz,",")
icount=UBound(ali)
For i=0 To icount
For j=icount - 1 To i Step -1
If j+1 <= UBound(ali) Then
If int(ali(j))<int(ali(j+1)) Then
itemp=ali(j)
ali(j)=ali(j+1)
ali(j+1)=itemp
End If
End If
Next
Next
For ii=0 to Ubound(ali)
If ii = Ubound(ali) Then
NewOrder = NewOrder & ali(ii)
Else
NewOrder = NewOrder & ali(ii) & ","
End If
Next
End Function
%>
调用方法:
<%
str = "234,54,294,2347,653,121,37,34578,4537,53,34,7,2,5768,2"
response.write NewOrder(str)
%>