java中判断数字带小数点后取两位

<span style="white-space:pre">		</span>String a="123.23";
		 Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"); 
		   Matcher isNum = pattern.matcher(a);
		   if( !isNum.matches() ){
			   System.out.println("不是数字");
		   }
		   else
		   {
			   System.out.println("是数字");
		   }

你可能感兴趣的:(小数点后取两位正则,Java判断金额正则,Java判断数字,Java判断数字小数点后取两位)