static void Main(string[] args)
{
string s = @" 15462wjkhsk\asd/sadasgf:y ertert*?ert<>|";
s=SpecialCode(s);
Console.WriteLine("{0}",s);
}
#region 过滤特殊字符
public static string SpecialCode(string s)
{
s = s.Replace(@"\", "");
s = Regex.Replace(s, "[ \\[ \\] \\^ \\-_*×――(^)$%~!/@#$…&%¥—+=<>《》|!!???::•`·、。,;,.;\"‘’“”-]", "").ToUpper();
return s;
}
#endregion
C# 过滤特殊字符
最新推荐文章于 2024-09-02 11:19:51 发布