Answers for "how to to upper a whole string in c++"

C++
3

string to upper c++

std::string data = "This is a sample string.";
// convert string to upper case
std::for_each(data.begin(), data.end(), [](char & c){
c = ::toupper(c);
});
Posted by: Guest on May-09-2020
0

convert all strings in vector to lowercase or uppercase c++

for(std::string &s : stringVector){
    std::transform(s.begin(), s.end(), s.begin(), 
        [](char c){ return std::toupper(c); }); // for lowercase change "toupper" -> "tolower" 
}
Posted by: Guest on September-16-2020

Code answers related to "how to to upper a whole string in c++"

Browse Popular Code Answers by Language