首页 > 代码库 > 数字排序
数字排序
strA="152648937"
WScript.Echo reversestr(strA)
Function reversestr(strT)
Set regEx=New RegExp
regex.Pattern="\d"
regex.Global=True
regex.IgnoreCase=True
For i=0 To Len(strT)-1
singlestr = Mid(strT,i+1,1)
str=str & singlestr & ","
Set exeStr = regex.Execute(singlestr)
If regex.Test(singlestr)=False Then
WScript.Echo "不是数字!"
WScript.Quit
End If
Next
strArr=Split(str,",")
For i=0 To UBound(strArr)
For j=0 To UBound(strArr)
If strArr(i)>strArr(j) Then
t=strArr(i)
strArr(i)=strArr(j)
strArr(j)=t
End If
Next
Next
reversestr=Join(strArr,"")
End Function
数字排序