首页 > 代码库 > 数字排序

数字排序

strA="152648937"
WScript.Echo reversestr(strA)
Function reversestr(strT)
    Set regEx=NewRegExp
    regex.Pattern="\d"
    regex.Global=True
    regex.IgnoreCase=True
    For i=0ToLen(strT)-1
        singlestr = Mid(strT,i+1,1)
        str=str & singlestr & ","
        Set exeStr = regex.Execute(singlestr)
        If regex.Test(singlestr)=FalseThen
            WScript.Echo "不是数字!"
            WScript.Quit
        EndIf
    Next
    strArr=Split(str,",")
    For i=0ToUBound(strArr)
        For j=0ToUBound(strArr)
            If strArr(i)>strArr(j) Then
                t=strArr(i)
                strArr(i)=strArr(j)
                strArr(j)=t
            EndIf
        Next
    Next
    reversestr=Join(strArr,"")
EndFunction

数字排序