更快速地验证所有数字的字符串的方法 [英] Faster method of validating a string for all digits
问题描述
我有一个测试所有数字的可变长度字符串的方法:
Dim ch As String
Dim i As Integer
AllDigits = True
对于i = 1到Len(txt)
''查看下一个字符是否为非数字。
ch = Mid $(txt,i,1)
如果ch< " 0"或者ch> " 9"然后
''这不是数字。
AllDigits = False
退出
结束如果
下一步我是
有没有人知道vb.net中更快的方法,不需要
循环字符串的长度,直到无效字符为止发现?
(txt,i,1)
如果ch< " 0"或者ch> " 9"然后
''这不是数字。
AllDigits = False
退出
结束如果
下一步我是
有没有人知道vb.net中更快的方法,不需要
循环字符串的长度,直到无效字符为止发现了?
Tim Frawley < TI ********* @ fishgame.state.ak.us>在消息中写道
新闻:bf ************************* @ posting.google.co m ... < blockquote class =post_quotes>我有一个测试所有数字的可变长度字符串的方法:
Dim ch As String
Dim i As Integer
AllDigits =正确
对于i = 1到Len(txt)
''查看下一个字符是否为非数字。
ch = Mid
( txt,i,1)
如果ch< " 0"或者ch> " 9"然后
''这不是一个数字。
AllDigits = False
退出
结束如果
下一个我
有谁知道在vb.net中一个更快的方法,不需要循环字符串的长度,直到找到无效字符?
functin isNumeric怎么样? ?
I have a method for testing variable length strings for all digits:
Dim ch As String
Dim i As Integer
AllDigits = True
For i = 1 To Len(txt)
'' See if the next character is a non-digit.
ch = Mid$(txt, i, 1)
If ch < "0" Or ch > "9" Then
'' This is not a digit.
AllDigits = False
Exit For
End If
Next i
Does anyone know of a faster method in vb.net that does not require
looping the length of the string until an invalid character is found?
(txt, i, 1)
If ch < "0" Or ch > "9" Then
'' This is not a digit.
AllDigits = False
Exit For
End If
Next i
Does anyone know of a faster method in vb.net that does not require
looping the length of the string until an invalid character is found?
"Tim Frawley" <ti*********@fishgame.state.ak.us> wrote in message
news:bf*************************@posting.google.co m...I have a method for testing variable length strings for all digits:
Dim ch As String
Dim i As Integer
AllDigits = True
For i = 1 To Len(txt)
'' See if the next character is a non-digit.
ch = Mid
(txt, i, 1)
If ch < "0" Or ch > "9" Then
'' This is not a digit.
AllDigits = False
Exit For
End If
Next i
Does anyone know of a faster method in vb.net that does not require
looping the length of the string until an invalid character is found?
how about the functin isNumeric??
这篇关于更快速地验证所有数字的字符串的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!