Monthly Archives: February 2013

[HowTo] LINQ filter : Ignore accented letters (Diacritics) in string comparison ?

Here is a small extension method that will do the job (Warning : do not use for Linq To Sql): public static string RemoveDiacritics(this string text) { string formD = text.Normalize(NormalizationForm.FormD); StringBuilder sb = new StringBuilder(); foreach (char ch in formD) { UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(ch); if (uc != UnicodeCategory.NonSpacingMark) { sb.Append(ch); } } return […]