Answers for "replace special characters in c#"

C#
2

regex replace all special characters

Regex.Replace(your String, @"[^0-9a-zA-Z]+", "")
Posted by: Guest on March-25-2020
1

c# string remove special characters

public static string RemoveSpecialCharacters(this string str) {
   StringBuilder sb = new StringBuilder();
   foreach (char c in str) {
      if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_') {
         sb.Append(c);
      }
   }
   return sb.ToString();
}
Posted by: Guest on May-20-2020

Code answers related to "replace special characters in c#"

C# Answers by Framework

Browse Popular Code Answers by Language