mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
[enhancement] 支持Float类型
This commit is contained in:
parent
4db9c44d18
commit
4ccb44ee26
@ -18,7 +18,7 @@ public class BooleanUtil {
|
||||
/** 表示为假的字符串 */
|
||||
private static final Set<String> FALSE_SET = SetUtil.of("false", "no", "n", "f", "0", "off", "否", "错", "假", "錯", "×");
|
||||
/** js中表示假值Falsy的部分值 false、0、-0、0n、""、null、undefined 和 NaN */
|
||||
public static final Set<Object> FALSY_SET = SetUtil.of(false, 0, -0, 0L, 0.0D, -0.0D, "", null);
|
||||
public static final Set<Object> FALSY_SET = SetUtil.of(false, 0, -0, 0L, 0.0D, -0.0D, 0.0F, -0.0F, "", null);
|
||||
|
||||
/**
|
||||
* 取相反值
|
||||
|
@ -105,6 +105,9 @@ public class BooleanUtilTest {
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(0.0D));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(0.00D));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(-0.00D));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(0.0F));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(0.00F));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(-0.00F));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(""));
|
||||
Assert.assertTrue(BooleanUtil.isJsFalsy(null));
|
||||
}
|
||||
@ -120,5 +123,6 @@ public class BooleanUtilTest {
|
||||
Assert.assertTrue(BooleanUtil.isJsTruthy(1L));
|
||||
Assert.assertTrue(BooleanUtil.isJsTruthy(0.1D));
|
||||
Assert.assertTrue(BooleanUtil.isJsTruthy(-0.01D));
|
||||
Assert.assertTrue(BooleanUtil.isJsTruthy(-0.01F));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user