using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Muchinfo.MTPClient.Infrastructure.Helpers
{
///
/// 字符串验证公共类 Add By DK 2016-11-22
///
public static class ValidationHelper
{
///
/// 验证手机号码
///
///
///
public static bool IsMobile(string str_handset)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_handset, @"^[1]+[3-9]+\d{9}$");
}
///
/// 验证输入为数字
///
///
///
public static bool IsNumber(string str_number)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$");
}
///
/// 验证电话号码
///
///
///
public static bool IsTelephone(string str_telephone)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_telephone, @"^(\d{3,4}-)?\d{6,8}$");
}
///
/// 验证身份证号
///
///
///
public static bool IsIDcard(string str_idcard)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_idcard, @"(^(\d{18}$|\d{17}(\d|X|x))$)|(^(\d{15}$|\d{14}(\d|X|x))$)");
}
///
/// 验证邮编
///
///
///
public static bool IsPostalcode(string str_postalcode)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_postalcode, @"^\d{6}$");
}
///
/// 验证邮箱
///
///
///
public static bool IsEmail(string str_Email)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_Email, @"\\w{1,}@\\w{1,}\\.\\w{1,}");
}
}
}