mardi 31 mars 2015

How to make a string uppercase (extended ASCII)?

I wrote this function to make a string all uppercase. Unfortunately, it does not work with the extended ASCII characters, like ä, ö, ü, é, è and so on. How can I convert the string to uppercase and convert these characters also (Ä, Ö, Ü, É, È)?



void toUppercase(string & strInOut)
{
std::locale loc;
for (std::string::size_type i=0; i<strInput.length(); ++i)
{
strInput.at(i) = std::toupper(strInput.at(i),loc);
}
return;
}

Aucun commentaire:

Enregistrer un commentaire