Posted by Amitabh Ghuwalewala on December 04, 2001 at 11:36:45:
In Reply to: c++ string to lowercase posted by Shawn Pullum on December 04, 2001 at 00:39:53:
: hi everyone, i was wondering if anyone knew an easy way to convert a string (c++ style) to lowercase and/or uppercase. i am hoping there is a simple built in function where i don't have to use char arrays. thanks.
The only way I can think of is to use a char arrya. the steps are pretty simple, you have to typecast the character, so "a" becomes an integer (it's ASCII value) and then subtract 32 and then typeast it again. This converts it to Uppercase "A". To convert to lower case you will have to add 32 to the uppercase ASCII value.
Post a Followup