|
-
Oct 28th, 2009, 11:14 AM
#1
Thread Starter
Addicted Member
[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.
-
Oct 28th, 2009, 11:24 AM
#2
Hyperactive Member
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 .
-
Oct 28th, 2009, 11:27 AM
#3
Thread Starter
Addicted Member
Re: Upper Case, Lower Case Question
-
Oct 28th, 2009, 11:28 AM
#4
Re: Upper Case, Lower Case Question
or you can use the .ToLower function of the string object to just convert everything to lowercase.
-tg
-
Oct 28th, 2009, 11:38 AM
#5
Re: Upper Case, Lower Case Question
One more way...
vb Code:
Select Case strChar Case "A","a" '~~> Your code End Select
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 28th, 2009, 11:46 AM
#6
Thread Starter
Addicted Member
Re: Upper Case, Lower Case Question
Ok thanks all great ideas, koolsid your way was exactly what I was looking for thanks.
-
Oct 28th, 2009, 11:48 AM
#7
Re: [RESOLVED] Upper Case, Lower Case Question
Glad to be of Help
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|