Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dark Rain

C++ equivalent of toupper, tolower?

This topic is 5724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ^_^.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
try this..


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


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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What is a retarded badger ?
Is that like a troll ?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You have been moderated. Have a nice day!

[edited by - Oluseyi on November 8, 2002 5:12:43 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You have been moderated again. Have a nice day!

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

Share this post


Link to post
Share on other sites

This topic is 5724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!