有没有办法检查字符串是否以任何 4 个字母开头。我正在寻找这样的东西:
If string like "####*" then
'DO STUFF
end if
“#”是数字,我需要同样的东西,但只用于字母。
这可以在没有正则表达式的情况下完成吗?
最佳答案
我不知道不使用正则表达式的方法。我们可以尝试使用正则表达式 Test
连同模式 ^[A-Z]{4}.*$
:
Dim input As String
Dim regex As Object
Set regex = New RegExp
regex.Pattern = "^[A-Z]{4}.*$"
input = "ABCD blah"
If regex.Test(input) Then
'DO STUFF
End If
关于excel - 有没有一种简单的方法来检查字符串是否以字母开头(任何 4 个字母)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59452021/