I need to compare two strings in German language to check if they are equal and only differ in the use of umlaute. E.g. "Jörg" should be the same as "Joerg".
So I tried:
var ci = new CultureInfo("de-DE");
int compareResult = ci.CompareInfo.Compare("jörg", "joerg", CompareOptions.IgnoreNonSpace);
as well as
int compareResult = String.Compare("jörg", "joerg", true, ci);
(or are those two equal anyway?)
However, this does not work and will return 1
. It is the same for all umlauts ö,ü and ä. If I compare strasse
and straße
in the same way, this does work and returns 0
?!
Thanks for any ideas! This post suggests that mine should work.