After reading this I'm still confused :
string s1 = "hello";
string s2 = "héllo";
The difference thing here is the accent/culture.
The result of the following code is False
.
Console.WriteLine(s1.Equals(s2, StringComparison.InvariantCulture));
But Im using invariant culture , so it should treat é as e.( default is English ,no?)
it seems that I have to go all the way to use
String.Compare(String, String, CultureInfo, CompareOptions)
like
string.Compare(s1, s2, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) //true
But , my current culture is he-IL
so I have no CLUE why it is working.
so :
I can't understand when the
CompareOptions
didn't work although I usedStringComparison.InvariantCulture
( and please don't reference me to the msdn page , cause I've already read it and I don't fully understand their explanation )In simple words , when should I use each overload ?
Doesn't nonspacing combining characters is a culture thing ?