string to uppercase cpp code example
Example 1: convert all characters in string to uppercase c++
transform(str.begin(), str.end(), str.begin(), ::toupper);
Example 2: 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);
});