public abstract class NumberParser
extends java.lang.Object
Parser for numeric values.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MAX_BYTE
String representation of byte.MAX_VALUE.
|
static java.lang.String |
MAX_INT
String representation of int.MAX_VALUE.
|
static java.lang.String |
MAX_LONG
String representation of long.MAX_VALUE.
|
static java.lang.String |
MAX_SHORT
String representation of short.MAX_VALUE.
|
static java.lang.String |
MIN_BYTE
String representation of byte.MIN_VALUE.
|
static java.lang.String |
MIN_INT
String representation of int.MIN_VALUE.
|
static java.lang.String |
MIN_LONG
String representation of long.MIN_VALUE.
|
static java.lang.String |
MIN_SHORT
String representation of short.MIN_VALUE.
|
Constructor and Description |
---|
NumberParser() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isByte(java.lang.String value)
Check if
value is a valid value of type byte . |
static boolean |
isDecimal(java.lang.String value)
Check if
value is a valid value of type decimal . |
static boolean |
isHex(java.lang.String value)
Check if
value is a valid value of type int , in hexadecimnal format. |
static boolean |
isInt(java.lang.String value)
Check if
value is a valid value of type int , in decimal or hexadecimal format. |
static boolean |
isInteger(java.lang.String value)
Check if
value is a valid value of type integer . |
static boolean |
isLong(java.lang.String value)
Check if
value is a valid value of type long . |
static boolean |
isShort(java.lang.String value)
Check if
value is a valid value of type short . |
static java.lang.Byte |
parseByte(java.lang.String value)
Return (nullable)
value parsed as a signed byte . |
static java.lang.Integer |
parseHex(java.lang.String value)
Return (nullable)
value parsed as an int in unsigned hexadecimal format. |
static java.lang.Integer |
parseInt(java.lang.String value)
|
static java.lang.Integer |
parseInt(java.lang.String value,
int radix)
Return (nullable)
value parsed as a signed int in the specified radix . |
static java.lang.Long |
parseLong(java.lang.String value)
Return (nullable)
value parsed as a signed long . |
static java.lang.Short |
parseShort(java.lang.String value)
Return (nullable)
value parsed as a signed short . |
public static final java.lang.String MIN_BYTE
String representation of byte.MIN_VALUE.
public static final java.lang.String MAX_BYTE
String representation of byte.MAX_VALUE.
public static final java.lang.String MIN_SHORT
String representation of short.MIN_VALUE.
public static final java.lang.String MAX_SHORT
String representation of short.MAX_VALUE.
public static final java.lang.String MIN_INT
String representation of int.MIN_VALUE.
public static final java.lang.String MAX_INT
String representation of int.MAX_VALUE.
public static final java.lang.String MIN_LONG
String representation of long.MIN_VALUE.
public static final java.lang.String MAX_LONG
String representation of long.MAX_VALUE.
public static boolean isByte(java.lang.String value)
Check if value
is a valid value of type byte
.
value
- Numeric value in string format.public static boolean isDecimal(java.lang.String value)
Check if value
is a valid value of type decimal
.
value
- Numeric value in string format.public static boolean isHex(java.lang.String value)
Check if value
is a valid value of type int
, in hexadecimnal format.
value
- Numeric value in string format.public static boolean isInt(java.lang.String value)
Check if value
is a valid value of type int
, in decimal or hexadecimal format.
value
- Numeric value in string format.public static boolean isInteger(java.lang.String value)
Check if value
is a valid value of type integer
.
value
- Numeric value in string format.public static boolean isLong(java.lang.String value)
Check if value
is a valid value of type long
.
value
- Numeric value in string format.public static boolean isShort(java.lang.String value)
Check if value
is a valid value of type short
.
value
- Numeric value in string format.public static java.lang.Byte parseByte(java.lang.String value)
Return (nullable) value
parsed as a signed byte
.
value
- Numeric value in string format.value
parsed as a signed byte
.public static java.lang.Integer parseHex(java.lang.String value)
Return (nullable) value
parsed as an int
in unsigned hexadecimal format.
value
- Numeric value in string format, starting with "0x" or "0X".value
parsed as an int
in unsigned hexadecimal format.public static java.lang.Integer parseInt(java.lang.String value)
public static java.lang.Integer parseInt(java.lang.String value, int radix)
Return (nullable) value
parsed as a signed int
in the specified radix
.
value
- Numeric value in string format.radix
- Radix, 2 to 36.value
parsed as a signed int
in the specified radix
.public static java.lang.Long parseLong(java.lang.String value)
Return (nullable) value
parsed as a signed long
.
value
- Numeric value in string format.value
parsed as a signed long
.public static java.lang.Short parseShort(java.lang.String value)
Return (nullable) value
parsed as a signed short
.
value
- Numeric value in string format.value
parsed as a signed short
.