少年修仙传客户端代码仓库
client_linchunjie
2018-12-22 4422415d8524ceebdce52b0daace0b9d9c5fb340
5536 【前端】【1.4】取名的特殊符号做个屏蔽,从ASCII码中取范围屏蔽
1个文件已修改
14 ■■■■■ 已修改文件
Utility/UIHelper.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }