1 //金额验证  
 2 public static boolean isNumber(String str){   
 3      Pattern pattern=Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"); // 判断小数点后2位的数字的正则表达式  
 4      Matcher match=pattern.matcher(str);   
 5      if(match.matches()==false){   
 6         return false;   
 7      }else{   
 8         return true;   
 9      }   
10  }  

 

posted on 2018-03-13 15:41  减肥的小老斧  阅读(11661)  评论(1编辑  收藏  举报