加入反扫金额校验

This commit is contained in:
lyf
2023-02-24 15:11:06 +08:00
parent c03ec8d1dc
commit 33950f8101
3 changed files with 19 additions and 2 deletions

View File

@@ -391,4 +391,17 @@ public class StringUtil extends StringUtils {
return null;
}
}
/**
* 金额校验
* @param str
* @return
*/
public static boolean isMoney(String str) {
// 判断小数点后2位的数字的正则表达式
Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$");
Matcher match = pattern.matcher(str);
return match.matches();
}
}