toLower(toUpper(a)) != a
len(toLower(toUpper(a))) != a
If your code assumes any of this, it already was brokenBut now, if you don’t have your locale set to Turkish, then you have
toUpper(“ı”) = “I”, toLower(“I”) = “i”
so the character does not round trip.
toLower(toUpper(a)) == toLower(a)
toLower(toLower(a)) == toLower(a)
should work though, with German even that is not guaranteed unless you really spend a lot of time figuring out when to convert SS to ß. I suppose making toLower convert ß to ss would avoid that particular problem, but I'm not sure the Germans would agree with that one (which is why I said no nice solution exists).At the very least it looks like you need a different toLower for style purposes than one for string comparison, unless someone can come up with a string where replacing ß with ss changes the meaning (or some equivalent to this), in which case there's no hope.
But that function would not be toLower(), it would be toSwiss()
> unless someone can come up with a string where replacing ß with ss changes the meaning
"Er trinkt in Maßen" - He drinks with moderation.
"Er trinkt in Massen" - He drinks huge amounts.
The pronounciation is different, too, a vowel before "ß" is long, before "ss" short.