Re: Finding out if a given character is in UpperCase, LowerCase or Numeric

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Rick Rothstein (MVP - VB) wrote:
I wanted to know if there is some process in vb to find out if a given
character is in UpperCase, LowerCase or Numeric.

Try this function out...

Function CharacterType(Char As String) As String
If Char Like "[A-Z]" Then
CharacterType = "Upper Case"
ElseIf Char Like "[a-z]" Then
CharacterType = "Lower Case"
ElseIf Char Like "#" Then
CharacterType = "Digit"
Else
CharacterType = "Not Alpha-Numeric"
End If
End Sub

Rick
I seldom use the Like operator. In this case it's very readable, but in most cases (where the strength of the operator is revealed) it's hardly readable what it does in fact.

Sinna
.



Relevant Pages