I have strings like 10A or 20B. I want 10 in 10A or 20 in 20B. How to split only numbers from string using VBScript or QTP internal commands?
I would use a regular expression:
s = "20B"
Set re = New RegExp
re.Pattern = "^\d+"
For Each m In re.Execute(s)
num = CInt(m)
Next
WScript.Echo num
来源:https://stackoverflow.com/questions/39601885/retrieve-only-numbers-and-ignore-alphabets-from-string