Java 金额正则表达式

Pattern pattern = Pattern.compile(“^((([1-9]{1}//d{0,9}))|([0]{1}))((//.(//d){2}))?$”);
Matcher matcher = pattern.matcher(“3333333333.99”);
System.out.println(matcher.matches());

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

你可能感兴趣的:(JAVA,Android)