日期:2011-10-09  浏览次数:21036 次

FunctionSort(ary)
DimKeepChecking,I,FirstValue,SecondValue
 KeepChecking=TRUE
DoUntilKeepChecking=FALSE
 KeepChecking=FALSE
 ForI=0toUBound(ary)
 IfI=UBound(ary)ThenExitFor
  Ifary(I)>ary(I+1)Then
   FirstValue=ary(I)
   SecondValue=ary(I+1)
   ary(I)=SecondValue
   ary(I+1)=FirstValue
   KeepChecking=TRUE
  EndIf
 Next
Loop
 Sort=ary
EndFunction
 
dimID,ArrayID,Myarray,M
ID="55,48,78,10,90"
ArrayID=split(ID,",")
Myarray=Sort(ArrayID)
'排序测试
ForM=0ToUbound(Myarray)
     Response.WriteMyarray(M)&"<br>"&vbCRLF
Next
 
'当然也可以用下面的,
DimMyarray
Myarray=Array(12,10,25,78,45)
Myarray=Sort(ArrayID)
'排序测试
ForM=0ToUbound(Myarray)
     Response.WriteMyarray(M)&"<br>"&vbCRLF
Next
'排序测试