@Immutable public final class StringParser extends Object
StringHelper.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_RADIX
The default radix used to convert string values to numeric values
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isDouble(String sStr)
Checks if the given string is a double string that can be converted to a
double value.
|
static boolean |
isFloat(String sStr)
Checks if the given string is a float string that can be converted to a
double value.
|
static boolean |
isInt(String sStr)
Checks if the given string is a numeric string that can be converted to a
long value with radix 10.
|
static boolean |
isLong(String sStr)
Checks if the given string is a numeric string that can be converted to a
long value with radix 10.
|
static boolean |
isUnsignedInt(String sStr)
Checks if the given string is a numeric string that can be converted to an
unsigned long value with radix 10.
|
static boolean |
isUnsignedLong(String sStr)
Checks if the given string is a numeric string that can be converted to an
unsigned long value with radix 10.
|
static BigDecimal |
parseBigDecimal(String sStr)
Parse the given
String as BigDecimal. |
static BigDecimal |
parseBigDecimal(String sStr,
BigDecimal aDefault)
Parse the given
String as BigDecimal. |
static BigDecimal |
parseBigDecimal(String sStr,
int nScale,
RoundingMode eRoundingMode)
Parse the given
String as BigDecimal. |
static BigDecimal |
parseBigDecimal(String sStr,
int nScale,
RoundingMode eRoundingMode,
BigDecimal aDefault)
Parse the given
String as BigDecimal. |
static BigInteger |
parseBigInteger(String sStr)
|
static BigInteger |
parseBigInteger(String sStr,
BigInteger aDefault)
|
static BigInteger |
parseBigInteger(String sStr,
int nRadix)
Parse the given
String as BigInteger with the specified
radix. |
static BigInteger |
parseBigInteger(String sStr,
int nRadix,
BigInteger aDefault)
Parse the given
String as BigInteger with the specified
radix. |
static boolean |
parseBool(Object aObject)
Try to interpret the passed object as boolean.
|
static boolean |
parseBool(Object aObject,
boolean bDefault)
Try to interpret the passed object as boolean.
|
static boolean |
parseBool(String sStr)
Parse the given
String as boolean value. |
static boolean |
parseBool(String sStr,
boolean bDefault)
Parse the given
String as boolean value. |
static Boolean |
parseBoolObj(Object aObject)
Try to interpret the passed object as boolean.
|
static Boolean |
parseBoolObj(Object aObject,
Boolean aDefault)
|
static Boolean |
parseBoolObj(String sStr)
Returns a
Boolean with a value represented by the specified
string. |
static Boolean |
parseBoolObjExact(String sStr)
Returns a
Boolean with a value represented by the specified
string. |
static Boolean |
parseBoolObjExact(String sStr,
Boolean aDefault)
Returns a
Boolean with a value represented by the specified
string. |
static byte |
parseByte(Object aObject,
byte nDefault)
|
static byte |
parseByte(Object aObject,
int nRadix,
byte nDefault)
Parse the given
Object as byte with the specified radix. |
static byte |
parseByte(String sStr,
byte nDefault)
|
static byte |
parseByte(String sStr,
int nRadix,
byte nDefault)
Parse the given
String as byte with the specified radix. |
static Byte |
parseByteObj(Object aObject)
|
static Byte |
parseByteObj(Object aObject,
Byte aDefault)
|
static Byte |
parseByteObj(Object aObject,
int nRadix,
Byte aDefault)
|
static Byte |
parseByteObj(String sStr)
|
static Byte |
parseByteObj(String sStr,
Byte aDefault)
|
static Byte |
parseByteObj(String sStr,
int nRadix,
Byte aDefault)
|
static double |
parseDouble(Object aObject,
double dDefault)
Parse the given
Object as double. |
static double |
parseDouble(String sStr,
double dDefault)
Parse the given
String as double. |
static Double |
parseDoubleObj(Object aObject)
|
static Double |
parseDoubleObj(Object aObject,
Double aDefault)
|
static Double |
parseDoubleObj(String sStr)
|
static Double |
parseDoubleObj(String sStr,
Double aDefault)
|
static float |
parseFloat(Object aObject,
float fDefault)
Parse the given
Object as float. |
static float |
parseFloat(String sStr,
float fDefault)
Parse the given
String as float. |
static Float |
parseFloatObj(Object aObject)
|
static Float |
parseFloatObj(Object aObject,
Float aDefault)
|
static Float |
parseFloatObj(String sStr)
|
static Float |
parseFloatObj(String sStr,
Float aDefault)
|
static int |
parseInt(Object aObject,
int nDefault)
Parse the given
Object as int with radix DEFAULT_RADIX. |
static int |
parseInt(Object aObject,
int nRadix,
int nDefault)
Parse the given
Object as int with the specified radix. |
static int |
parseInt(String sStr,
int nDefault)
|
static int |
parseInt(String sStr,
int nRadix,
int nDefault)
Parse the given
String as int with the specified radix. |
static Integer |
parseIntObj(Object aObject)
|
static Integer |
parseIntObj(Object aObject,
Integer aDefault)
|
static Integer |
parseIntObj(Object aObject,
int nRadix,
Integer aDefault)
|
static Integer |
parseIntObj(String sStr)
|
static Integer |
parseIntObj(String sStr,
Integer aDefault)
|
static Integer |
parseIntObj(String sStr,
int nRadix,
Integer aDefault)
|
static long |
parseLong(Object aObject,
int nRadix,
long nDefault)
Parse the given
Object as long with the specified radix. |
static long |
parseLong(Object aObject,
long nDefault)
|
static long |
parseLong(String sStr,
int nRadix,
long nDefault)
Parse the given
String as long with the specified radix. |
static long |
parseLong(String sStr,
long nDefault)
|
static Long |
parseLongObj(Object aObject)
|
static Long |
parseLongObj(Object aObject,
int nRadix,
Long aDefault)
|
static Long |
parseLongObj(Object aObject,
Long aDefault)
|
static Long |
parseLongObj(String sStr)
|
static Long |
parseLongObj(String sStr,
int nRadix,
Long aDefault)
|
static Long |
parseLongObj(String sStr,
Long aDefault)
|
static short |
parseShort(Object aObject,
int nRadix,
short nDefault)
Parse the given
Object as short with the specified radix. |
static short |
parseShort(Object aObject,
short nDefault)
|
static short |
parseShort(String sStr,
int nRadix,
short nDefault)
Parse the given
String as short with the specified radix. |
static short |
parseShort(String sStr,
short nDefault)
|
static Short |
parseShortObj(Object aObject)
|
static Short |
parseShortObj(Object aObject,
int nRadix,
Short aDefault)
|
static Short |
parseShortObj(Object aObject,
Short aDefault)
|
static Short |
parseShortObj(String sStr)
|
static Short |
parseShortObj(String sStr,
int nRadix,
Short aDefault)
|
static Short |
parseShortObj(String sStr,
Short aDefault)
|
public static final int DEFAULT_RADIX
public static boolean parseBool(@Nullable Object aObject)
String or a Boolean.aObject - The object to be interpreted. May be null.false if the passed object cannot be interpreted as a
boolean.public static boolean parseBool(@Nullable Object aObject, boolean bDefault)
String or a Boolean.aObject - The object to be interpreted. May be null.bDefault - The default value to be returned, if the object cannot be
interpreted.public static boolean parseBool(@Nullable String sStr)
String as boolean value. All values that are equal
to "true" (ignoring case) will result in true return values.
All other values result in false return values. This method is
equal to Boolean.parseBoolean(String)sStr - The string to be interpreted. May be null.true if the passed string matches "true" (ignoring
case), false otherwise.Boolean.parseBoolean(String)public static boolean parseBool(@Nullable String sStr, boolean bDefault)
String as boolean value. All values that are equal
to "true" (ignoring case) will result in true return values.
All values that are equal to "false" (ignoring case) will result in
false return values. All other values will return the default.sStr - The string to be interpreted. May be null.bDefault - The default value to be returned if the passed string is neither
"true" nor "false".true or false :)@Nullable public static Boolean parseBoolObj(@Nullable Object aObject)
String or a Boolean.aObject - The object to be interpreted. May be null.null if the passed object cannot be interpreted as a
boolean, any other Boolean otherwise.@Nullable public static Boolean parseBoolObj(@Nullable Object aObject, @Nullable Boolean aDefault)
aObject - The object to be interpreted. May be null.aDefault - The default value to be returned, if the passed object is
null.null,
the matching Boolean otherwise.@Nonnull public static Boolean parseBoolObj(@Nullable String sStr)
Boolean with a value represented by the specified
string. The Boolean returned represents a true
value if the string argument is not null and is equal,
ignoring case, to the string "true". This method is equal to
Boolean.valueOf(String)sStr - The string to be parsed. May be null.Boolean value represented by the string. Never
null.@Nullable public static Boolean parseBoolObjExact(@Nullable String sStr)
Boolean with a value represented by the specified
string. The Boolean returned represents a true
value if the string argument is not null and is equal,
ignoring case, to the string "true", and it will return
false if the string argument is not null and is
equal, ignoring case, to the string "false". In all other cases
null is returned.sStr - The string to be parsed. May be null.Boolean value represented by the string. Never
null.@Nullable public static Boolean parseBoolObjExact(@Nullable String sStr, @Nullable Boolean aDefault)
Boolean with a value represented by the specified
string. The Boolean returned represents a true
value if the string argument is not null and is equal,
ignoring case, to the string "true", and it will return
false if the string argument is not null and is
equal, ignoring case, to the string "false". In all other cases
aDefault is returned.sStr - The string to be parsed. May be null.aDefault - The default value to be returned if the value is neither "true" nor
"false". May be null.Boolean value represented by the string. Never
null.public static byte parseByte(@Nullable Object aObject, byte nDefault)
aObject - The Object to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static byte parseByte(@Nullable Object aObject, @Nonnegative int nRadix, byte nDefault)
Object as byte with the specified radix.aObject - The Object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static byte parseByte(@Nullable String sStr, byte nDefault)
sStr - The String to parse. May be null.nDefault - The value to be returned if the string cannot be converted to a
valid value.public static byte parseByte(@Nullable String sStr, @Nonnegative int nRadix, byte nDefault)
String as byte with the specified radix.sStr - The String to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The value to be returned if the string cannot be converted to a
valid value.@Nullable public static Byte parseByteObj(@Nullable Object aObject)
aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Byte parseByteObj(@Nullable Object aObject, @Nullable Byte aDefault)
aObject - The object to parse. May be null.aDefault - The default value to be returned, if the passed object cannot be
converted. May be null.@Nullable public static Byte parseByteObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Byte aDefault)
aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned, if the passed object cannot be
converted. May be null.@Nullable public static Byte parseByteObj(@Nullable String sStr)
sStr - The String to parse. May be null.null if the string does not represent a valid value.@Nullable public static Byte parseByteObj(@Nullable String sStr, @Nullable Byte aDefault)
sStr - The String to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static Byte parseByteObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Byte aDefault)
sStr - The String to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.public static double parseDouble(@Nullable Object aObject, double dDefault)
Object as double. Note: both the locale independent
form of a double can be parsed here (e.g. 4.523) as well as a localized
form using the comma as the decimal separator (e.g. the German 4,523).aObject - The object to parse. May be null.dDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static double parseDouble(@Nullable String sStr, double dDefault)
String as double.sStr - The string to parse. May be null.dDefault - The default value to be returned if the passed object could not be
converted to a valid value.@Nullable public static Double parseDoubleObj(@Nullable Object aObject)
Object as Double. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Double parseDoubleObj(@Nullable Object aObject, @Nullable Double aDefault)
Object as Double. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).aObject - The object to parse. May be null.aDefault - The default value to be returned if the parsed object cannot be
converted to a double. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Double parseDoubleObj(@Nullable String sStr)
String as Double. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).sStr - The string to parse. May be null.null if the object does not represent a valid value.@Nullable public static Double parseDoubleObj(@Nullable String sStr, @Nullable Double aDefault)
String as Double. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).sStr - The string to parse. May be null.aDefault - The default value to be returned if the parsed string cannot be
converted to a double. May be null.aDefault if the object does not represent a valid
value.public static float parseFloat(@Nullable Object aObject, float fDefault)
Object as float. Note: both the locale independent
form of a float can be parsed here (e.g. 4.523) as well as a localized form
using the comma as the decimal separator (e.g. the German 4,523).aObject - The object to parse. May be null.fDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static float parseFloat(@Nullable String sStr, float fDefault)
String as float.sStr - The string to parse. May be null.fDefault - The default value to be returned if the passed object could not be
converted to a valid value.@Nullable public static Float parseFloatObj(@Nullable Object aObject)
Object as Float. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Float parseFloatObj(@Nullable Object aObject, @Nullable Float aDefault)
Object as Float. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).aObject - The object to parse. May be null.aDefault - The default value to be returned if the parsed object cannot be
converted to a float. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Float parseFloatObj(@Nullable String sStr)
String as Float. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).sStr - The string to parse. May be null.null if the object does not represent a valid value.@Nullable public static Float parseFloatObj(@Nullable String sStr, @Nullable Float aDefault)
String as Float. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).sStr - The string to parse. May be null.aDefault - The default value to be returned if the parsed string cannot be
converted to a float. May be null.aDefault if the object does not represent a valid
value.public static int parseInt(@Nullable Object aObject, int nDefault)
Object as int with radix DEFAULT_RADIX.aObject - The Object to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static int parseInt(@Nullable Object aObject, @Nonnegative int nRadix, int nDefault)
Object as int with the specified radix.aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static int parseInt(@Nullable String sStr, int nDefault)
sStr - The String to parse. May be null.nDefault - The value to be returned if the string cannot be converted to a
valid value.public static int parseInt(@Nullable String sStr, @Nonnegative int nRadix, int nDefault)
String as int with the specified radix.sStr - The String to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The value to be returned if the string cannot be converted to a
valid value.@Nullable public static Integer parseIntObj(@Nullable Object aObject)
aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Integer parseIntObj(@Nullable Object aObject, @Nullable Integer aDefault)
aObject - The object to parse. May be null.aDefault - The default value to be returned if the passed object cannot be
converted to an Integer. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Integer parseIntObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Integer aDefault)
aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed object cannot be
converted to an Integer. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Integer parseIntObj(@Nullable String sStr)
sStr - The string to parse. May be null.null if the string does not represent a valid value.@Nullable public static Integer parseIntObj(@Nullable String sStr, @Nullable Integer aDefault)
sStr - The string to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static Integer parseIntObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Integer aDefault)
sStr - The string to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.public static long parseLong(@Nullable Object aObject, long nDefault)
aObject - The object to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static long parseLong(@Nullable Object aObject, @Nonnegative int nRadix, long nDefault)
Object as long with the specified radix.aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static long parseLong(@Nullable String sStr, long nDefault)
sStr - The string to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static long parseLong(@Nullable String sStr, @Nonnegative int nRadix, long nDefault)
String as long with the specified radix.sStr - The string to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.@Nullable public static Long parseLongObj(@Nullable Object aObject)
aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Long parseLongObj(@Nullable Object aObject, @Nullable Long aDefault)
aObject - The object to parse. May be null.aDefault - The default value to be returned if the passed object cannot be
converted to a Long. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Long parseLongObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Long aDefault)
aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed object cannot be
converted to a Long. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Long parseLongObj(@Nullable String sStr)
sStr - The string to parse. May be null.null if the string does not represent a valid value.@Nullable public static Long parseLongObj(@Nullable String sStr, @Nullable Long aDefault)
sStr - The string to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static Long parseLongObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Long aDefault)
sStr - The string to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.public static short parseShort(@Nullable Object aObject, short nDefault)
aObject - The object to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static short parseShort(@Nullable Object aObject, @Nonnegative int nRadix, short nDefault)
Object as short with the specified radix.aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static short parseShort(@Nullable String sStr, short nDefault)
sStr - The string to parse. May be null.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.public static short parseShort(@Nullable String sStr, @Nonnegative int nRadix, short nDefault)
String as short with the specified radix.sStr - The string to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.nDefault - The default value to be returned if the passed object could not be
converted to a valid value.@Nullable public static Short parseShortObj(@Nullable Object aObject)
aObject - The object to parse. May be null.null if the object does not represent a valid value.@Nullable public static Short parseShortObj(@Nullable Object aObject, @Nullable Short aDefault)
aObject - The object to parse. May be null.aDefault - The default value to be returned if the passed object cannot be
converted to a Short. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Short parseShortObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Short aDefault)
aObject - The object to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed object cannot be
converted to a Short. May be null.aDefault if the object does not represent a valid
value.@Nullable public static Short parseShortObj(@Nullable String sStr)
sStr - The string to parse. May be null.null if the string does not represent a valid value.@Nullable public static Short parseShortObj(@Nullable String sStr, @Nullable Short aDefault)
sStr - The string to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static Short parseShortObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Short aDefault)
sStr - The string to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static BigInteger parseBigInteger(@Nullable String sStr)
sStr - The String to parse. May be null.null if the string does not represent a valid value.@Nullable public static BigInteger parseBigInteger(@Nullable String sStr, @Nonnegative int nRadix)
String as BigInteger with the specified
radix.sStr - The String to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.null if the string does not represent a valid value.@Nullable public static BigInteger parseBigInteger(@Nullable String sStr, @Nullable BigInteger aDefault)
sStr - The String to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static BigInteger parseBigInteger(@Nullable String sStr, @Nonnegative int nRadix, @Nullable BigInteger aDefault)
String as BigInteger with the specified
radix.sStr - The String to parse. May be null.nRadix - The radix to use. Must be ≥ Character.MIN_RADIX and ≤
Character.MAX_RADIX.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr)
String as BigDecimal.sStr - The String to parse. May be null.null if the string does not represent a valid value.@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nullable BigDecimal aDefault)
String as BigDecimal.sStr - The String to parse. May be null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode)
String as BigDecimal.sStr - The String to parse. May be null.nScale - The scaling (decimal places) to be used for the result. Must be ≥
0!eRoundingMode - The rounding mode to be used to achieve the scale. May not be
null.null if the string does not represent a valid value.@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnegative int nScale, @Nonnull RoundingMode eRoundingMode, @Nullable BigDecimal aDefault)
String as BigDecimal.sStr - The String to parse. May be null.nScale - The scaling (decimal places) to be used for the result. Must be ≥
0!eRoundingMode - The rounding mode to be used to achieve the scale. May not be
null.aDefault - The default value to be returned if the passed string could not be
converted to a valid value. May be null.aDefault if the string does not represent a valid
value.public static boolean isInt(@Nullable String sStr)
sStr - The string to check. May be null.true if the value can be converted to a valid valuepublic static boolean isLong(@Nullable String sStr)
sStr - The string to check. May be null.true if the value can be converted to a valid valuepublic static boolean isUnsignedInt(@Nullable String sStr)
sStr - The string to check. May be null.true if the value can be converted to a valid valuepublic static boolean isUnsignedLong(@Nullable String sStr)
sStr - The string to check. May be null.true if the value can be converted to a valid valuepublic static boolean isDouble(@Nullable String sStr)
sStr - The string to check. May be null.true if the value can be converted to a valid valueCopyright © 2014–2017 Philip Helger. All rights reserved.