Count Alphabetical characters using VBScript
In order to count Alphabetical characters using VBScript in a string, first we need to get the characters from the given string, one char at a time using the mid function of VBScript. Then check if the character is a numeric character. If no numeric character is found using isNumeric function, the given string is an alphabetical string.
Example code: Count alphabetical characters using VBScript
Function countAlphaChars()
Dim oStr
Dim oLength
Dim oChar
Dim iCounter
oStr="goo23gle5"
oLength=len(oStr)
oAlphacounter=0
For iCounter=1 to oLength
If not isnumeric (mid(oStr,iCounter,1)) then
oAlphacounter=oAlphacounter+1
End if
Next
print oAlphacounter
countAlphaChars=oAlphacounter
End Function
Discover more from automationscript
Subscribe to get the latest posts sent to your email.