加入反扫金额校验
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user