mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
3085d29f51
commit
3df784b1cf
@ -791,11 +791,10 @@ public class NumberUtil {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(s);
|
Double.parseDouble(s);
|
||||||
return s.contains(".");
|
|
||||||
} catch (final NumberFormatException ignore) {
|
} catch (final NumberFormatException ignore) {
|
||||||
// ignore
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return s.contains(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1690,6 +1689,9 @@ public class NumberUtil {
|
|||||||
* @since 4.6.7
|
* @since 4.6.7
|
||||||
*/
|
*/
|
||||||
public static boolean isValidNumber(final Number number) {
|
public static boolean isValidNumber(final Number number) {
|
||||||
|
if(null == number){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (number instanceof Double) {
|
if (number instanceof Double) {
|
||||||
return (false == ((Double) number).isInfinite()) && (false == ((Double) number).isNaN());
|
return (false == ((Double) number).isInfinite()) && (false == ((Double) number).isNaN());
|
||||||
} else if (number instanceof Float) {
|
} else if (number instanceof Float) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user