public final class NumberUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isNumeric(Object value)
Useful for figuring out if an Object is a number.
|
static boolean |
isNumeric(String str)
Deprecated.
There is already a dependency in this project on Apache
common-lang, so you should probably use
org.apache.commons.lang.math.NumberUtils. |
public static boolean isNumeric(Object value)
@Deprecated public static boolean isNumeric(String str)
org.apache.commons.lang.math.NumberUtils.Checks if the String contains only unicode digits. A decimal point is a digit and returns true.
null will return false. An empty String ("")
will return true.
StringUtils.isNumeric(null) = false
StringUtils.isNumeric("") = true
StringUtils.isNumeric(" ") = false
StringUtils.isNumeric("123") = true
StringUtils.isNumeric("12 3") = false
StringUtils.isNumeric("ab2c") = false
StringUtils.isNumeric("12-3") = false
StringUtils.isNumeric("12.3") = true
str - the String to check, may be nulltrue if only contains digits, and is non-nullCopyright © 2010-2015 JmxTrans team. All Rights Reserved.