Here is a quick C# tip, when using string compare don’t use
1 2 3 |
var str = "Hello"; if(str.ToLower() === "hello") |
use the Equals and StringComparison.InvariantCultureIgnoreCase enum.
1 2 3 |
var str = "Hello"; if(str.Equals("hello", StringComparison.InvariantCultureIgnoreCase)) |
The thing you need to note is which rules are appropriate current culture, the invariant culture, ordinal or another culture entirely. One can create the compare from StringComparer.Create(culture, true)