This commit is contained in:
Looly 2022-06-30 17:54:44 +08:00
parent 3c7513a2bb
commit 9a6acc8329
2 changed files with 17 additions and 17 deletions

View File

@ -3,9 +3,11 @@
-------------------------------------------------------------------------------------------------------------
# 5.8.5.M1 (2022-06-27)
# 5.8.5.M1 (2022-06-30)
### 🐣新特性
* 【core 】 NumberUtil新增isIn方法pr#669@Gitee
*
### 🐞Bug修复
-------------------------------------------------------------------------------------------------------------

View File

@ -1238,7 +1238,7 @@ public class NumberUtil {
* @return 是否为整数
*/
public static boolean isInteger(String s) {
if(StrUtil.isBlank(s)) {
if (StrUtil.isBlank(s)) {
return false;
}
try {
@ -1258,7 +1258,7 @@ public class NumberUtil {
* @since 4.0.0
*/
public static boolean isLong(String s) {
if(StrUtil.isBlank(s)) {
if (StrUtil.isBlank(s)) {
return false;
}
try {
@ -1276,7 +1276,7 @@ public class NumberUtil {
* @return 是否为{@link Double}类型
*/
public static boolean isDouble(String s) {
if(StrUtil.isBlank(s)) {
if (StrUtil.isBlank(s)) {
return false;
}
try {
@ -1816,19 +1816,17 @@ public class NumberUtil {
/**
* 检查值是否在指定范围内
*
* @param value
* @param min 最小值包含
* @param max 最大值包含
* @param value
* @param minInclude 最小值包含
* @param maxInclude 最大值包含
* @return 经过检查后的值
**/
public static boolean isIn(final BigDecimal value, final BigDecimal min,final BigDecimal max){
* @since 5.8.5
*/
public static boolean isIn(final BigDecimal value, final BigDecimal minInclude, final BigDecimal maxInclude) {
Assert.notNull(value);
Assert.notNull(min);
Assert.notNull(max);
if(isGreaterOrEqual(value,min) && isLessOrEqual(value,max)){
return true;
}
return false;
Assert.notNull(minInclude);
Assert.notNull(maxInclude);
return isGreaterOrEqual(value, minInclude) && isLessOrEqual(value, maxInclude);
}
/**
@ -2550,7 +2548,7 @@ public class NumberUtil {
* @since 4.1.15
*/
public static Number parseNumber(String numberStr) throws NumberFormatException {
if(StrUtil.startWithIgnoreCase(numberStr, "0x")){
if (StrUtil.startWithIgnoreCase(numberStr, "0x")) {
// 0x04表示16进制数
return Long.parseLong(numberStr.substring(2), 16);
}
@ -2688,7 +2686,7 @@ public class NumberUtil {
* @since 4.6.7
*/
public static boolean isValidNumber(Number number) {
if(null == number){
if (null == number) {
return false;
}
if (number instanceof Double) {