📌  相关文章
📜  c#字符串删除特殊字符 - C#代码示例

📅  最后修改于: 2022-03-11 14:49:07.030000             🧑  作者: Mango

代码示例1
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();
}