Package com.github.tonyluo.excel.util
Class NumberUtils
java.lang.Object
com.github.tonyluo.excel.util.NumberUtils
public class NumberUtils
extends java.lang.Object
copy from org.apache.commons.lang3.math.NumberUtils
-
Field Summary
Fields Modifier and Type Field Description static boolean
IS_JAVA_1_6
static java.lang.String
JAVA_SPECIFICATION_VERSION
-
Constructor Summary
Constructors Constructor Description NumberUtils()
-
Method Summary
Modifier and Type Method Description static boolean
isCreatable(java.lang.String str)
Checks whether the String a valid Java number.
-
Field Details
-
IS_JAVA_1_6
public static final boolean IS_JAVA_1_6 -
JAVA_SPECIFICATION_VERSION
public static final java.lang.String JAVA_SPECIFICATION_VERSION
-
-
Constructor Details
-
NumberUtils
public NumberUtils()
-
-
Method Details
-
isCreatable
public static boolean isCreatable(java.lang.String str)Checks whether the String a valid Java number.
Valid numbers include hexadecimal marked with the
0x
or0X
qualifier, octal numbers, scientific notation and numbers marked with a type qualifier (e.g. 123L).Non-hexadecimal strings beginning with a leading zero are treated as octal values. Thus the string
09
will returnfalse
, since9
is not a valid octal value. However, numbers beginning with0.
are treated as decimal.
input resulting innull
and empty/blankString
will returnfalse
.true
- Parameters:
str
- theString
to check- Returns:
true
if the string is a correctly formatted number- Since:
- 3.5 the code supports the "+" suffix on numbers except for integers in Java 1.6
-