What is the best way people have found to do String to Lower case / Upper case in C++?
The issue is complicated by the fact that C++ isn't an English only programming language. Is there a good multilingual method?
tolower() function in C/C++If the character passed is an uppercase alphabet then the tolower() function converts an uppercase alphabet to a lowercase alphabet. int tolower(int ch); Basically tolower() returns an int value and in C language we can user %c to convert that int value to char value.
Java String toUpperCase() Method The toUpperCase() method converts a string to upper case letters. Note: The toLowerCase() method converts a string to lower case letters.
Lower converts any uppercase letters to lowercase. Upper converts any lowercase letters to uppercase.
toupper() function in CThe toupper() function is used to convert lowercase alphabet to uppercase. i.e. If the character passed is a lowercase alphabet then the toupper() function converts a lowercase alphabet to an uppercase alphabet. It is defined in the ctype.
#include <algorithm> std::string data = "Abc"; std::transform(data.begin(), data.end(), data.begin(), ::toupper);
http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/
Also, CodeProject article for common string methods: http://www.codeproject.com/KB/stl/STL_string_util.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With