public class NumberUtils
extends java.lang.Object
Constructor and Description |
---|
NumberUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isCreatable(java.lang.String str)
Checks whether the String a valid Java number.
|
public static boolean isCreatable(java.lang.String str)
Checks whether the String a valid Java number.
Valid numbers include hexadecimal marked with the 0x
or
0X
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 return
false
, since 9
is not a valid octal value.
However, numbers beginning with 0.
are treated as decimal.
null
and empty/blank String
will return
false
.
Note, createNumber(String) should return a number for every
input resulting in true
.
str
- the String
to checktrue
if the string is a correctly formatted number