asp中怎样用replace函数将文本替换只保留数字

2024-11-19 11:19:37
推荐回答(3个)
回答1:

Function GetNumber(mystring As String) As String
Dim i As Integer
Dim str As String
For i = 1 To Len(mystring)
If IsNumeric(Mid(mystring, i, 1)) Then
str = str & Mid(mystring, i, 1)
End If
Next
GetNumber = str
End Function

回答2:

a="sz87,,01szjy8*r6w"
for i=1 to len(a)
b=mid(a,i,1)
if IsNumeric(b) then
c=c&b
end if
next
Response.Write(c)

回答3:

例如有一段文本,我想把其中的