How could one convert a string to upper case. The examples I have found from googling only have to deal with chars.

31 Answers
31

#include <algorithm>
#include <string>

std::string str = "Hello World";
std::transform(str.begin(), str.end(),str.begin(), ::toupper);

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *