字符串只返回数字

asp函数

2008-09-29 10:10

Public Function GetStrNum(Str)
If Len(Str)<=0 Then Exit Function
For i=0 To Len(Str)
   oTemp = Mid(Str,i+1,1)
   If IsNumeric(oTemp) Then
    GetStrAllNum=GetStrAllNum&oTemp
   End If
Next
GetStrNum=GetStrAllNum
End Function

GetStrNum("2fds,786sf5%")         25
GetStrNum("c834xx3xx")               8343
GetStrNum("c934dt5")                  9345