private static boolean isInteger(String str) {
// 可以包含小数 Pattern pattern = Pattern.compile("^[0-9]+(.[0-9]+)?$");
// 只包含两位小数 Pattern pattern=Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"); return pattern.matcher(str).matches(); }
标签:Java,正则表达式,Pattern,是否是,compile,str,pattern,小数 From: https://www.cnblogs.com/lanliying/p/17296785.html