Exemplo n.º 1
0
 /// <summary>
 /// 根据正则判断是否是有效的数据
 /// </summary>
 /// <param name="s"></param>
 /// <param name="strtype"></param>
 /// <returns></returns>
 public static bool IsValid(this string s, FrequentRegularEnum pattern)
 {
     if (!s.IsNullOrWhiteSpace())
     {
         return(Regex.IsMatch(s, StringHelper.GetFrequentRegularStr(pattern)));
     }
     return(false);
 }
 /// <summary>
 /// 常用规则
 /// </summary>
 /// <param name="type"></param>
 /// <param name="errormsg"></param>
 public CustomerAttribute(FrequentRegularEnum type, string errormsg) : base(StringHelper.GetFrequentRegularStr(type))
 {
     ErrorMessage = errormsg;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取常用的正则数据 不合格数据替换
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetFrequentReplaceStr(FrequentRegularEnum type) => type switch
 {