0
How to translate text that cout produces into lowercase letters
C++
3 Antworten
+ 3
If you don't have access to boost or you don't want it as a dependency on your program, you can use <algorithm> and iterate through each character, converting it to lowercase.
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c){ return std::tolower(c); });
+ 2
there are thusands of methods to conver lower to upper or upper to lower the simplest methos you can use it is using boost algorith.
#include <boost/algorithm/string.hpp>
std::string str = "HELLO, WORLD!";
boost::algorithm::to_lower(str);