private static string RemoveNotLetter(string title) { var listSign = new List<string> { "|", "'", ",", "&", ".", "!" }; var notLetter = Regex.Split(title, @"[a-zA-Z]/[0-9]", RegexOptions.IgnoreCase).Where(r => r.Trim() != string.Empty).ToList(); var newLetter = new List<string>(); for (int i = notLetter.Count - 1; i >= 0; i--) { if (notLetter[i].Trim().Length == 0) { notLetter.RemoveAt(i); continue; } if (notLetter[i].Trim().Length > 1) { for (int j = 0; j < notLetter[i].Trim().Length; j++) { newLetter.Add(notLetter[i].Trim().Substring(j, 1)); } notLetter.RemoveAt(i); } } notLetter.AddRange(newLetter); foreach (string sign in notLetter) { if (sign.Trim().Length == 0) continue; if (!listSign.Contains(sign.Trim())) { title = title.Replace(sign.Trim(), ""); } } return title; } private string str(string strs){ string str=strs; char[] ch = str.ToCharArray(); System.Text.RegularExpressions.Regex R = new System.Text.RegularExpressions.Regex("[A-Z]"); str = ""; foreach (char s in ch) { if (R.IsMatch(s.ToString())) { str += s.ToString().ToLower(); } else { str += s.ToString().ToUpper(); } } return str; }