简易代码之家

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks
public static bool RegexValidate(string validateString) 
        
{
            Regex regex 
= new Regex("^[0-9]+(.[0-9]{0,2})?$");
            
//验证有两位小数的正实数:^[0-9]+(.[0-9]{2})?$ 
            
//验证有1-3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$
            return regex.IsMatch(validateString.Trim()); 
        }
posted on 2014-07-25 09:54 Jakin.zhou 阅读(133) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: