Solved strings in C++

August 2, 2011 at 11:04:11
Specs: Windows 7
hey, does anyone know how to convert a string from upper case to lower case and vice verse???

See More: strings in C++

Report •


#1
August 2, 2011 at 11:17:11
Apply the function toupper() (or tolower()) to each element of the string.

Report •

#2
August 2, 2011 at 11:59:07
ok thank u.but how can i know if the string is in upper case or lower case???

Report •

#3
August 2, 2011 at 14:02:07
✔ Best Answer
That doesn't matter. As long as you know which case you want it to end up as. Apply toupper() to an upper case character and it won't change it.

Of course you can always test the characters if 'a' <= c <= 'z' then it's lower case, if 'A' <= c <= 'Z' then it's upper case.


Report •
Related Solutions


Ask Question