验证电话号码的主要代码如下:
   public bool IsTelephone(string str_telephone)
   {
   return System.Text.RegularExpressions.Regex.IsMatch(str_telephone,@"^(\d{3,4}-)?\d{6,8}$");
   }
验证手机号码的主要代码如下:

public static bool IsHandset(string str_handset)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_handset, @"^1[3456789]\d{9}$");
}


验证身份证号的主要代码如下:
   public bool IsIDcard(string str_idcard)
   {
   return System.Text.RegularExpressions.Regex.IsMatch(str_idcard,@"(^\d{18}$)|(^\d{15}$)");
   }
验证输入为数字的主要代码如下:
   public bool IsNumber(string str_number)
   {
   return System.Text.RegularExpressions.Regex.IsMatch(str_number,@"^[0-9]*$");
   }
验证邮编的主要代码如下:
   public boolIsPostalcode(string str_postalcode)
   {
   return System.Text.RegularExpressions.Regex.IsMatch(str_postalcode,@"^\d{6}$");
   }

 

相关文章:

  • 2022-01-10
  • 2021-12-20
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
  • 2021-05-29
相关资源
相似解决方案