brickbuilder
New Member
- Joined
- Apr 10, 2015
- Messages
- 30
Trying to clean up a number that's always written out. The problem is isAlpha is either not being called or is returning true on certain type of spacing...not sure if it's return or whitespace or tab....I looked at the ascii chart and isAlpha seems to be bounded correctly. Confused!
isAlpha
Code:
phoneNum = Mid(replyText, pos + Len(phoneDelim))
For i = 1 To Len(phoneNum)
If isAlpha(Mid(phoneNum, i, 1)) = True Then
phoneNum = Mid(phoneNum, i)
phoneNum = Left(phoneNum, InStr(phoneNum, vbLf) - 1)
Exit For
End If
Next i
isAlpha
Code:
Function isAlpha(str As String) As Boolean
'checks whether the string is completely alphabetic
Dim Flag As Boolean
Dim s As String
Flag = True
For i = 1 To Len(Trim(str))
s = Asc(Mid(Trim(str), i, 1))
If s > 64 And s < 91 Or s > 96 And s < 123 Then 'space counts as alpha '32'
'do nothing
Else
Flag = False
End If
Next i
If Flag = True Then
isAlpha = True
Else
isAlpha = False
End If
End Function