Vb.net 检查字符串是否有(9位),然后
有类似的吗Vb.net 检查字符串是否有(9位),然后,vb.net,Vb.net,有类似的吗 if abc.text = (some 9 digits/characeters) then Endif 它应该是精确的9位/字符,然后只有它进入if语句 有什么想法吗?您可以检查字符串的长度是否等于9: If abc.Text.Length = 9 Then 'ToDo EndIf 您可以检查字符串的长度是否等于9: If abc.Text.Length = 9 Then 'ToDo EndIf 如果你想检查一下我们的长度 If abc.text.Lengh
if abc.text = (some 9 digits/characeters) then
Endif
它应该是精确的9位/字符,然后只有它进入if语句
有什么想法吗?您可以检查字符串的长度是否等于9:
If abc.Text.Length = 9 Then
'ToDo
EndIf
您可以检查字符串的长度是否等于9:
If abc.Text.Length = 9 Then
'ToDo
EndIf
如果你想检查一下我们的长度
If abc.text.Lenght = 9 Then
End IF
但是,如果您希望仅限制数字或字符,请使用reqular表达式
Dim objRegExp As New System.Text.RegularExpressions.Regex("^[a-zA-Z0-9]{9}$")
If objRegExp.Match(abc).Success
End If
不要忘记导入:
Imports System.Text.RegularExpressions
如果你想检查一下我们的长度
If abc.text.Lenght = 9 Then
End IF
但是,如果您希望仅限制数字或字符,请使用reqular表达式
Dim objRegExp As New System.Text.RegularExpressions.Regex("^[a-zA-Z0-9]{9}$")
If objRegExp.Match(abc).Success
End If
不要忘记导入:
Imports System.Text.RegularExpressions
端模块
结束模块
abc.Text.Length=9
Oh,thanx,写下答案,这样我就可以投票了@NicoSchertlerabc.Text.Length=9
噢,thanx,写下答案,这样我就可以投票了@尼科舍勒