发布:2023/2/27 23:35:23作者:管理员 来源:本站 浏览次数:611
/// <summary>
/// 验证电话号码
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public static bool IsTel(string telephoneNumber)
{
return System.Text.RegularExpressions.Regex.IsMatch(telephoneNumber, @"^(\d{3,4}-)?\d{6,8}$");
}
/// <summary>
/// 验证手机号码
/// </summary>
/// <param name="str_handset"></param>
/// <returns></returns>
public static bool IsMobile(string mobile)
{
if (string.IsNullOrEmpty(mobile))
return false;
return Regex.IsMatch(mobile, @"^(1)\d{10}$");
}
/// <summary>
/// 验证输入为数字
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public static bool IsNumber(string str_number)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$");
}
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4