5536 【前端】【1.4】取名的特殊符号做个屏蔽,从ASCII码中取范围屏蔽
| | |
| | | }
|
| | | }
|
| | |
|
| | | private const string SPECIAL_CHA = " ()()@!#$%^&*[]|_";
|
| | | static Regex s_SpecialCharacterRegex = new Regex("[ ()()@!#$%^&*[]|_]");
|
| | | static Regex s_AsciiCharacterRegex = new Regex("[\x00-\x2F]|[\x3A-\x40]|[\x5B-\x60]|[\x7B-\x7E]");
|
| | | public static bool HasSpecialCharac(string str)
|
| | | {
|
| | | foreach (char c in SPECIAL_CHA)
|
| | | if (s_SpecialCharacterRegex.IsMatch(str))
|
| | | {
|
| | | if (str.Contains(c))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return true;
|
| | | }
|
| | | if (s_AsciiCharacterRegex.IsMatch(str))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|