去除特殊字符

/// <summary>
/// 去除特殊字符
/// </summary>
/// <param name="str">待处理的字符串</param>
/// <returns></returns>
public static string RemoveSpecialChar(string str)
{
  return Regex.Replace(str, "[\\[\\]\\^\\-_*×――(^)$%~!@#$…&%¥—+=<>" +
    "|{}!!???::•`·、。,;,.;\"‘’'-]", "");
}

posted @ 2020-04-30 14:50  🍋.レモン  阅读(157)  评论(0编辑  收藏  举报