문제

Is there a function like IsNumeric() in VBScript to check if a string contains only alphanumeric (a-zA-Z0-9) characters? Or can this only be determined by regular expressions?

도움이 되었습니까?

해결책

Use the ^ feature (not in class) of RegExps to search for characters not in (a-zA-Z0-9):

>> Set r = New RegExp
>> r.Pattern = "[^a-zA-Z0-9]"
>> For Each t In Array("aA0", "a.0")
>>     WScript.Echo t, CStr(r.Test(t))
>> Next
>>
aA0 False
a.0 True
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top