#include#include int main() { std::string text = "Hello, WoRlD!"; std::string lower_text = tolower(text); std::cout << lower_text << std::endl; // output: "hello, world!" return 0; }
#includeThis example uses the std::transform function to convert all characters in a string to their lowercase form. The std::tolower function is used as a lambda function to perform the conversion. Package library: Standard C++ Library (STL)#include #include int main() { std::string text = "Hello, WoRlD!"; std::transform(text.begin(), text.end(), text.begin(), [](unsigned char c){ return std::tolower(c); } ); std::cout << text << std::endl; // output: "hello, world!" return 0; }