Converting strings to Upper case in C++

Sharky Forums


Results 1 to 3 of 3

Thread: Converting strings to Upper case in C++

  1. #1
    Catfish
    Join Date
    Oct 2002
    Posts
    141

    Converting strings to Upper case in C++

    I need to make sure that the letters in a string are uppercase to do some searching in a vector. The format of the string will be "A9999", but the user needs to be able to put in "a9999" and have it find their account. I seem to remember a funtion that would make a string uppercase. if any of you know, please tell me so I can do this.
    I appreciate it alot.

  2. #2
    Hammerhead Shark EverlastingGod's Avatar
    Join Date
    Feb 2003
    Location
    MD
    Posts
    1,364
    You can try looping through the characters in the string, using "toupper" from ctype.h (or just cctype if your not using the ".h" version)
    Stay cool
    and be somebody's fool this year

  3. #3
    Tiger Shark Remington's Avatar
    Join Date
    Apr 2001
    Location
    Calgary, Alberta, Canada
    Posts
    702
    Can't you simply use strupr() from string.h ?
    It's not ANSI so maybe you wouldn't want to include it though.
    Last edited by Remington; 04-25-2003 at 05:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •