|
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
|
public class AgeUtil {
|
|
public class AgeUtil {
|
|
|
|
|
|
// 数字正则,支持20;20.3;20.;.8
|
|
// 数字正则,支持20;20.3;20.;.8
|
|
- public static final String NUMBER_REGEX = "[0-9]+|([0-9]+\\.)[0-9]*|[0-9]*(\\.[0-9]+)";
|
|
|
|
|
|
+ public static final String NUMBER_REGEX = "([0-9]+|([0-9]+\\.)[0-9]*|[0-9]*(\\.[0-9]+))";
|
|
|
|
|
|
/**
|
|
/**
|
|
* 年龄字符串转换成double类型
|
|
* 年龄字符串转换成double类型
|
|
@@ -198,6 +198,7 @@ public class AgeUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
-
|
|
|
|
|
|
+ String s = "50.天";
|
|
|
|
+ System.out.println(ageDay(s));
|
|
}
|
|
}
|
|
}
|
|
}
|