[RESOLVED] Upper Case, Lower Case Question
Ok i have a program using a select case to convert letters to special charaters. My question is how can I get the code to read upper and lower case letters without having to put the upper case letters in my select case statement.
Example: Part of my code is
case "a"
word = "1"
and if i type apple i get 1pple
My question is, is there a way for me to type Apple and get 1pple without having to add this to my code
case "A"
word = "1"
I have been searching the commands char.toupper and char.isupper but i don't know how to implement them in my code. I know the code will word is i add the case "A" to my select case statement but I am trying to shorten up my code. I hope I am asking this question correctly.
Re: Upper Case, Lower Case Question
You could turn the word to Upper case before you test it. Then you know for sure that it will contain only upper case characters. Or vica versa.
Or you could use a Select Case True
Select case True
case word.equals("a") or word.equals("A")
End select
Can't think of much else :(.
Re: Upper Case, Lower Case Question
Re: Upper Case, Lower Case Question
or you can use the .ToLower function of the string object to just convert everything to lowercase.
-tg
Re: Upper Case, Lower Case Question
One more way...
vb Code:
Select Case strChar
Case "A","a"
'~~> Your code
End Select
Re: Upper Case, Lower Case Question
Ok thanks all great ideas, koolsid your way was exactly what I was looking for thanks.
Re: [RESOLVED] Upper Case, Lower Case Question
Glad to be of Help :wave: