首页 > 其他 > 详细

几个常用的正则判断

时间:2017-11-13 17:32:06      阅读:260      评论:0      收藏:0      [点我收藏+]
public static bool IsNumeric(string value)
{
         return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
}
public static bool IsInt(string value)
{
         return Regex.IsMatch(value, @"^[+-]?\d*$");
}
public static bool IsUnsign(string value)
{
         return Regex.IsMatch(value, @"^\d*[.]?\d*$");
}

 public static bool isTel(string strInput)
{
        return Regex.IsMatch(strInput, @"\d{3}-\d{8}|\d{4}-\d{7}");
}

 

几个常用的正则判断

原文:http://www.cnblogs.com/WZH75171992/p/7827212.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!