<%
'******************************
'函數:NewOrder(ArrStr)
'參數:Rstr,以逗號做分隔的數字數組
'作者:阿里西西
'日期:2007/7/13
'描述:重排序數字數組
'示例:<%=NewOrder("34,53,13,22,38,86,111,23,65")%>
'******************************
FunctionNewOrder(ArrStr)
Fori=0ToUbound(Split(ArrStr,","))
Ifn>0Then
ArrStr=Replace(ArrStr,n,0)
EndIf
sp=split(ArrStr,",")
n=0
Forj=0Toubound(sp)
Ifint(sp(j))>int(n)Then
n=sp(j)
EndIf
Next
NewOrder=NewOrder&replace(n,0,"")&""
Next
NewOrder=NewOrder
EndFunction
%>
對數組進行重新排序
複製代碼代碼如下:
<%
'******************************
'函數:NewOrder(sz)
'參數:Rstr,以逗號做分隔的數字數組
'作者:阿里西西
'日期:2007/7/13
'描述:對數組進行重新排序
'示例:<%=NewOrder("34,53,13,22,38,86,111,23,65")%>
'******************************
FunctionNewOrder(sz)
Dimali,icount,i,ii,j,itemp
ali=split(sz,",")
icount=UBound(ali)
Fori=0Toicount
Forj=icount-1ToiStep-1
Ifj+1<=UBound(ali)Then
Ifint(ali(j))<int(ali(j+1))Then
itemp=ali(j)
ali(j)=ali(j+1)
ali(j+1)=itemp
EndIf
EndIf
Next
Next
Forii=0toUbound(ali)
Ifii=Ubound(ali)Then
NewOrder=NewOrder&ali(ii)
Else
NewOrder=NewOrder&ali(ii)&","
EndIf
Next
EndFunction
%>