C++ equivalent of toupper, tolower?

Started by
23 comments, last by Dark Rain 21 years, 5 months ago
I know that you can use a stringstream to transform numbers into a string or vice versa but is there something to do the equivalent of toupper on my std::string or a tolower. It just seems "barbaric" to me to use C functions calls in my C++ code ^_^.
Advertisement
I haven''t found one, but yet again I haven''t done much searching. You might be able to find something in algorithm that executes a function on each element in the string, and you can set the function to upper or lower individual characters. I''m just throwing out ideas here
This should work, tho I haven''t tested it.


  #include <string>#include <algorithm>#include <cstring>using std::transform;using std::string;using std::toupper;transform(mystring.begin(), mystring.end(), // input range	mystring.begin(), // output range	toupper); // unary function object  


Don''t listen to me. I''ve had too much coffee.
:O I never noticed it when I searched for something like that in the stl library. Thanks!
try this..


cout << leetsor hackers.
(&&#0kjdjskd
sldjf
af


Sorry if its sloopy, I had to much coffe this
morning
quote:Original post by Anonymous Poster
try this..


cout << leetsor hackers.
(&kjdjskd
sldjf
af


Sorry if its sloopy, I had to much coffe this
morning

Careful, son... don''t get too close to it. It''s a retarded badger.

Don''t listen to me. I''ve had too much coffee.
What is a retarded badger ?
Is that like a troll ?
quote:Original post by Anonymous Poster
cout << leetsor hackers.
(&kjdjskd
sldjf
af


Sorry if its sloopy, I had to much coffe this
morning
You can never have too much coffee. The problem is that you didn''t have enough.
You have been moderated. Have a nice day!

[edited by - Oluseyi on November 8, 2002 5:12:43 PM]
You have been moderated again. Have a nice day!

[edited by - Oluseyi on November 8, 2002 5:13:09 PM]

This topic is closed to new replies.

Advertisement