From 4422415d8524ceebdce52b0daace0b9d9c5fb340 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期六, 22 十二月 2018 11:55:09 +0800
Subject: [PATCH] 5536 【前端】【1.4】取名的特殊符号做个屏蔽,从ASCII码中取范围屏蔽
---
Utility/UIHelper.cs | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Utility/UIHelper.cs b/Utility/UIHelper.cs
index be61689..45f96f7 100644
--- a/Utility/UIHelper.cs
+++ b/Utility/UIHelper.cs
@@ -371,15 +371,17 @@
}
}
- 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;
}
--
Gitblit v1.8.0