Results 1 to 7 of 7

Thread: [RESOLVED] Upper Case, Lower Case Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    133

    Resolved [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.

  2. #2
    Hyperactive Member gonzalioz's Avatar
    Join Date
    Sep 2009
    Location
    <body></body>
    Posts
    508

    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 .

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    133

    Re: Upper Case, Lower Case Question

    ok thanks will try

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Upper Case, Lower Case Question

    or you can use the .ToLower function of the string object to just convert everything to lowercase.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Upper Case, Lower Case Question

    One more way...

    vb Code:
    1. Select Case strChar
    2. Case "A","a"
    3. '~~> Your code
    4. 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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2009
    Posts
    133

    Re: Upper Case, Lower Case Question

    Ok thanks all great ideas, koolsid your way was exactly what I was looking for thanks.

  7. #7
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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
  •  



Click Here to Expand Forum to Full Width