Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String To Lower/Upper in C++

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?

like image 849
Adam Avatar asked Aug 14 '08 18:08

Adam


People also ask

Is upper to lower in C?

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.

How do you convert lower case string to upper case?

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.

What is the used of lower () and upper ()?

Lower converts any uppercase letters to lowercase. Upper converts any lowercase letters to uppercase.

What is string Upper in C?

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.


1 Answers

#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

like image 57
Darren Kopp Avatar answered Oct 04 '22 02:10

Darren Kopp