|
@@ -530,8 +530,8 @@ public class CoreUtil {
|
|
|
if (StringUtil.isEmpty(ageStr)) {
|
|
|
return 20.0;
|
|
|
}
|
|
|
- // 全是整形数字,当成年龄处理
|
|
|
- if (numbersOnly(ageStr)) {
|
|
|
+ // 数值,当成年龄处理
|
|
|
+ if (isNumbers(ageStr)) {
|
|
|
return Double.parseDouble(ageStr);
|
|
|
}
|
|
|
// 20日
|
|
@@ -589,13 +589,13 @@ public class CoreUtil {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 判断字符串是否 仅 包含数字
|
|
|
+ * 判断字符串是否数值(正)
|
|
|
*
|
|
|
* @param str
|
|
|
* @return
|
|
|
*/
|
|
|
public static boolean isNumbers(String str) {
|
|
|
- String regex = "^[0-9]*(\\.?)[0-9]*$";
|
|
|
+ String regex = "[0-9]+|([0-9]+\\.)+[0-9]*|[0-9]*(\\.[0-9]+)+";
|
|
|
return str.matches(regex);
|
|
|
}
|
|
|
|