Answers for "c# string remove special characters"

C#
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 "c# string remove special characters"

C# Answers by Framework

Browse Popular Code Answers by Language