Make a STL string Lowercase

From Stack Overflow
Jump to: navigation, search
#include <string>
#include <algorithm>
std::transform(myString.begin(), myString.end(), myString.begin(), ::tolower);

From: http://stackoverflow.com/questions/313970/stl-string-to-lower-case

Or, using Boost, from http://www.boost.org/doc/libs/1_44_0/doc/html/string_algo/usage.html#id2580058

std::string str1("HeLlO WoRld!");
boost::to_lower(str1); // str1=="hello world!"
Personal tools