添加项目文件。
This commit is contained in:
35
XXCpzs/Helper/Verification.cs
Normal file
35
XXCpzs/Helper/Verification.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace XXCpzs.helper
|
||||
{
|
||||
public class Verification
|
||||
{
|
||||
// 验证电话号码的主要代码如下:
|
||||
public static 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]+[3,5]+\d{9}");
|
||||
}
|
||||
// 验证身份证号的主要代码如下:
|
||||
public static bool IsIDcard(string str_idcard)
|
||||
{
|
||||
return System.Text.RegularExpressions.Regex.IsMatch(str_idcard, @"(^\d{18}$)|(^\d{15}$)");
|
||||
}
|
||||
// 验证输入为数字的主要代码如下:
|
||||
public static bool IsNumber(string str_number)
|
||||
{
|
||||
return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$");
|
||||
}
|
||||
// 验证邮编的主要代码如下:
|
||||
public static bool IsPostalcode(string str_postalcode)
|
||||
{
|
||||
return System.Text.RegularExpressions.Regex.IsMatch(str_postalcode, @"^\d{6}$");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user