How do I lowercase std::string?
Is there any other way besides my sauce? This looks so messy
char upperToLower(char in){
if(in<='Z' && in>='A')
return in-('Z'-'z');
return in;
}
...
std::transform(data.begin(), data.end(), data.begin(), ::upperToLower);
Write the toolower() provided by c++
#include <algorithm>
#include <string>
std::string data = "HELLO C WORLD";
std::transform(data.begin(), data.end(), data.begin(), ::tolower);
You can use it with .
© 2024 OneMinuteCode. All rights reserved.