devxlogo

Test if a Character in a String is a Letter

Test if a Character in a String is a Letter

There is a simple way to test if a character in a string is a letter.Just by using the UCase() And LCase() functions.

     Public Function IsLetter(Char As String) As Boolean    Dim sTemp As String        sTemp = Left$(Char, 1)        IsLetter = (StrComp(UCase(sTemp), LCase(sTemp), vbBinaryCompare)  0)    End Function

size=3>
Note: I use the StrComp function, to make it work independent of Option Compare.

devx-admin

Share the Post: