0

How to translate text that cout produces into lowercase letters

C++

28th Feb 2021, 7:47 PM
Щапов Алексей
Щапов Алексей - avatar
2 Respostas
+ 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); });
28th Feb 2021, 9:01 PM
inxanedev!
inxanedev! - avatar
+ 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);
28th Feb 2021, 8:11 PM
N A I E B I