java正则校验金额

it2022-05-05  171

public 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; } }

在此对原文作者表示感谢


最新回复(0)