Пример #1
0
        public static string ToCleanQuery(this string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            var str = DiacritisHelper.Remove(WebUtility.HtmlDecode(text.ToLower()));

            // invalid chars
            str = Regex.Replace(str, @"[^A-Za-z0-9\s]", "");
            // convert multiple spaces into one space
            str = Regex.Replace(str, @"\s+", " ").Trim();

            return(str);
        }
Пример #2
0
 public static string ToUnaccentedText(this string accentedString)
 {
     return(string.IsNullOrEmpty(accentedString) ? accentedString : DiacritisHelper.Remove(accentedString));
 }