Nicer algorithm for upper/lower

This commit is contained in:
Leonetienne 2021-12-05 17:57:12 +01:00
parent 98c83ae972
commit e961df211f

View File

@ -71,7 +71,7 @@ std::string StringTools::Lower(const std::string& str)
// Quick-accept: regular letters
if ((c >= 'A') && (c <= 'Z'))
ss << (char)(c + 32);
ss << (char)(c | 32);
// Damned umlautes:
else if (c == 'Ä') ss << 'ä';
@ -110,7 +110,7 @@ std::string StringTools::Upper(const std::string& str)
// Quick-accept: regular letters
if ((c >= 'a') && (c <= 'z'))
ss << (char)(c - 32);
ss << (char)(c & ~32);
// Damned umlautes:
else if (c == 'ä') ss << 'Ä';