日期:2014-05-17 浏览次数:20923 次
<% '排序 Function Sort1(ary) Dim KeepChecking,I,FirstValue,SecondValue 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 Sort1 = ary End Function Dim arr arr = Array("道_1","道_2","道_113","道_14","道_21","道_132","道_31","道_15","道_34","道_25") arr = Sort1(arr) For i=0 to ubound(arr) Response.Write(arr(i)&"<br />") Next %>
<% Dim arr arr = Array("道_1","道_2","道_113","道_14","道_21","道_132","道_31","道_15","道_34","道_25") Dim rs, i, a Set rs = CreateObject("ADODB.RecordSet") rs.Fields.Append "pre",200,50 rs.Fields.Append "num",3,4 rs.CursorLocation = 3 rs.Open For i = 0 To UBound(arr) a = Split(arr(i), "_") rs.AddNew rs("pre") = a(0) rs("num") = a(1) Next rs.Sort = "num ASC" rs.MoveFirst i = 0 Do While Not rs.EOF arr(i) = rs("pre") & "_" & rs("num") i = i + 1 rs.MoveNext Loop rs.Close Set rs = Nothing Response.Write Join(arr, ",") %>