diff --git a/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java b/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java index 59823be..fe9b5a8 100644 --- a/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java +++ b/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/ExcelUtils.java @@ -167,6 +167,24 @@ public class ExcelUtils { return false; } + /** + * 校验是否为数字字符串 并且 校验是否超过了2位小数 + * @param numStr + * @return + */ + public static Boolean checkNumberTwoPoint(String numStr){ + Pattern pattern = Pattern.compile("([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])|(0)"); + Matcher isNum = pattern.matcher(numStr); + if( !isNum.matches() ){ + return true; + } + int num = checkNumberLength(numStr); + if(num > 2){ + return true; + } + return false; + } + /** * 校验String类型数字有几位小数 * @param s 传入的数字格式的字符串