diff --git a/CHANGELOG.md b/CHANGELOG.md index a348aabc6..2206c4513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### 新特性 * 【http】 自动关闭HttpURLConnection的头安全检查(issue#512@Github) * 【setting】 Setting变量替换支持从系统参数中取值 +* 【core】 改进NumberUtil.isNumber方法(pr#68@Gitee) ### Bug修复 * 【db】 解决ThreadLocalConnection多数据源被移除问题(pr#66@Gitee) diff --git a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java index edaa6b7af..dddb047e5 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java @@ -1097,7 +1097,7 @@ public class NumberUtil { // two E's return false; } - if (!foundDigit) { + if (false == foundDigit) { return false; } hasExp = true; @@ -1142,12 +1142,12 @@ public class NumberUtil { } // allowSigns is true iff the val ends in 'E' // found digit it to make sure weird stuff like '.' and '1E-' doesn't pass - return !allowSigns && foundDigit; + return false == allowSigns && foundDigit; } /** * 判断String是否是整数
- * 支持8、10、16进制 + * 支持10进制 * * @param s String * @return 是否为整数 @@ -1163,7 +1163,7 @@ public class NumberUtil { /** * 判断字符串是否是Long类型
- * 支持8、10、16进制 + * 支持10进制 * * @param s String * @return 是否为{@link Long}类型