<%
'******************************
' Function: Neworder (ARRSTR)
' Parameter: RSTR, a comma-delimited array of numbers
' Author: Arisisi
' Date: 2007/7/13
' Description: Reordering numeric arrays
' Example: <%=neworder ("34,53,13,22,38,86,111,23,65")%>
'******************************
Function Neworder (ARRSTR)
For i = 0 to Ubound (Split (Arrstr, ","))
If n > 0 Then
Arrstr = Replace (arrstr,n,0)
End If
SP = Split (Arrstr, ",")
n = 0
For j = 0 To UBound (SP)
If Int (sp (j)) > Int (n) Then
n = SP (j)
End If
Next
Neworder = neworder & Replace (n,0, "") & ""
Next
Neworder = Neworder
End Function
%>
Reordering an array
Copy Code code as follows:
<%
'******************************
' Function: Neworder (SZ)
' Parameter: RSTR, a comma-delimited array of numbers
' Author: Arisisi
' Date: 2007/7/13
' Description: Reordering of arrays
' Example: <%=neworder ("34,53,13,22,38,86,111,23,65")%>
'******************************
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
%>