Package com.helger.base.string
Class StringParser
java.lang.Object
com.helger.base.string.StringParser
This class contains the methods to parse String objects to numeric values. Before v3.7.0 this was
contained in class StringHelper.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default radix used to convert string values to numeric values -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks if the given string is a double string that can be converted to a double value.static booleanChecks if the given string is a float string that can be converted to a double value.static booleanChecks if the given string is a numeric string that can be converted to a long value with radix 10.static booleanChecks if the given string is a numeric string that can be converted to a long value with radix 10.static booleanisUnsignedInt(@Nullable String sStr) Checks if the given string is a numeric string that can be converted to an unsigned long value with radix 10.static booleanisUnsignedLong(@Nullable String sStr) Checks if the given string is a numeric string that can be converted to an unsigned long value with radix 10.static @Nullable BigDecimalparseBigDecimal(@Nullable String sStr) Parse the givenStringasBigDecimal.static @Nullable BigDecimalparseBigDecimal(@Nullable String sStr, int nScale, @NonNull RoundingMode eRoundingMode) Parse the givenStringasBigDecimal.static @Nullable BigDecimalparseBigDecimal(@Nullable String sStr, int nScale, @NonNull RoundingMode eRoundingMode, @Nullable BigDecimal aDefault) Parse the givenStringasBigDecimal.static @Nullable BigDecimalparseBigDecimal(@Nullable String sStr, @Nullable BigDecimal aDefault) Parse the givenStringasBigDecimal.static @Nullable BigIntegerparseBigInteger(@Nullable String sStr) static @Nullable BigIntegerparseBigInteger(@Nullable String sStr, int nRadix) Parse the givenStringasBigIntegerwith the specified radix.static @Nullable BigIntegerparseBigInteger(@Nullable String sStr, int nRadix, @Nullable BigInteger aDefault) Parse the givenStringasBigIntegerwith the specified radix.static @Nullable BigIntegerparseBigInteger(@Nullable String sStr, @Nullable BigInteger aDefault) static booleanTry to interpret the passed object as boolean.static booleanTry to interpret the passed object as boolean.static booleanParse the givenStringas boolean value.static booleanParse the givenStringas boolean value.static @Nullable BooleanparseBoolObj(@Nullable Object aObject) Try to interpret the passed object as boolean.static @Nullable BooleanparseBoolObj(@Nullable Object aObject, @Nullable Boolean aDefault) static @NonNull BooleanparseBoolObj(@Nullable String sStr) Returns aBooleanwith a value represented by the specified string.static @Nullable BooleanparseBoolObjExact(@Nullable String sStr) Returns aBooleanwith a value represented by the specified string.static @Nullable BooleanparseBoolObjExact(@Nullable String sStr, @Nullable Boolean aDefault) Returns aBooleanwith a value represented by the specified string.static bytestatic byteParse the givenObjectas byte with the specified radix.static bytestatic byteParse the givenStringas byte with the specified radix.static @Nullable ByteparseByteObj(@Nullable Object aObject) static @Nullable ByteparseByteObj(@Nullable Object aObject, int nRadix, @Nullable Byte aDefault) static @Nullable ByteparseByteObj(@Nullable Object aObject, @Nullable Byte aDefault) static @Nullable ByteparseByteObj(@Nullable String sStr) static @Nullable ByteparseByteObj(@Nullable String sStr, int nRadix, @Nullable Byte aDefault) static @Nullable ByteparseByteObj(@Nullable String sStr, @Nullable Byte aDefault) static doubleparseDouble(@Nullable Object aObject, double dDefault) Parse the givenObjectas double.static doubleparseDouble(@Nullable String sStr, double dDefault) Parse the givenStringas double.static @Nullable DoubleparseDoubleObj(@Nullable Object aObject) static @Nullable DoubleparseDoubleObj(@Nullable Object aObject, @Nullable Double aDefault) static @Nullable DoubleparseDoubleObj(@Nullable String sStr) static @Nullable DoubleparseDoubleObj(@Nullable String sStr, @Nullable Double aDefault) static floatparseFloat(@Nullable Object aObject, float fDefault) Parse the givenObjectas float.static floatparseFloat(@Nullable String sStr, float fDefault) Parse the givenStringas float.static @Nullable FloatparseFloatObj(@Nullable Object aObject) static @Nullable FloatparseFloatObj(@Nullable Object aObject, @Nullable Float aDefault) static @Nullable FloatparseFloatObj(@Nullable String sStr) static @Nullable FloatparseFloatObj(@Nullable String sStr, @Nullable Float aDefault) static intParse the givenObjectas int with radixDEFAULT_RADIX.static intParse the givenObjectas int with the specified radix.static intstatic intParse the givenStringas int with the specified radix.static @Nullable IntegerparseIntObj(@Nullable Object aObject) static @Nullable IntegerparseIntObj(@Nullable Object aObject, int nRadix, @Nullable Integer aDefault) static @Nullable IntegerparseIntObj(@Nullable Object aObject, @Nullable Integer aDefault) static @Nullable IntegerparseIntObj(@Nullable String sStr) static @Nullable IntegerparseIntObj(@Nullable String sStr, int nRadix, @Nullable Integer aDefault) static @Nullable IntegerparseIntObj(@Nullable String sStr, @Nullable Integer aDefault) static longParse the givenObjectas long with the specified radix.static longstatic longParse the givenStringas long with the specified radix.static longstatic @Nullable LongparseLongObj(@Nullable Object aObject) static @Nullable LongparseLongObj(@Nullable Object aObject, int nRadix, @Nullable Long aDefault) static @Nullable LongparseLongObj(@Nullable Object aObject, @Nullable Long aDefault) static @Nullable LongparseLongObj(@Nullable String sStr) static @Nullable LongparseLongObj(@Nullable String sStr, int nRadix, @Nullable Long aDefault) static @Nullable LongparseLongObj(@Nullable String sStr, @Nullable Long aDefault) static shortparseShort(@Nullable Object aObject, int nRadix, short nDefault) Parse the givenObjectas short with the specified radix.static shortparseShort(@Nullable Object aObject, short nDefault) static shortparseShort(@Nullable String sStr, int nRadix, short nDefault) Parse the givenStringas short with the specified radix.static shortparseShort(@Nullable String sStr, short nDefault) static @Nullable ShortparseShortObj(@Nullable Object aObject) static @Nullable ShortparseShortObj(@Nullable Object aObject, int nRadix, @Nullable Short aDefault) static @Nullable ShortparseShortObj(@Nullable Object aObject, @Nullable Short aDefault) static @Nullable ShortparseShortObj(@Nullable String sStr) static @Nullable ShortparseShortObj(@Nullable String sStr, int nRadix, @Nullable Short aDefault) static @Nullable ShortparseShortObj(@Nullable String sStr, @Nullable Short aDefault) static @Nullable LongparseUnsignedIntObj(@Nullable String sStr) static @Nullable LongparseUnsignedIntObj(@Nullable String sStr, int nRadix, @Nullable Long aDefault) static @Nullable LongparseUnsignedIntObj(@Nullable String sStr, @Nullable Long aDefault)
-
Field Details
-
DEFAULT_RADIX
public static final int DEFAULT_RADIXThe default radix used to convert string values to numeric values- See Also:
-
-
Method Details
-
parseBool
Try to interpret the passed object as boolean. This works only if the passed object is either aStringor aBoolean.- Parameters:
aObject- The object to be interpreted. May benull.- Returns:
falseif the passed object cannot be interpreted as a boolean.
-
parseBool
Try to interpret the passed object as boolean. This works only if the passed object is either aStringor aBoolean.- Parameters:
aObject- The object to be interpreted. May benull.bDefault- The default value to be returned, if the object cannot be interpreted.- Returns:
- The boolean representation or the default value if the passed object cannot be interpreted as a boolean.
-
parseBool
Parse the givenStringas boolean value. All values that are equal to "true" (ignoring case) will result intruereturn values. All other values result infalsereturn values. This method is equal toBoolean.parseBoolean(String)- Parameters:
sStr- The string to be interpreted. May benull.- Returns:
trueif the passed string matches "true" (ignoring case),falseotherwise.- See Also:
-
parseBool
Parse the givenStringas boolean value. All values that are equal to "true" (ignoring case) will result intruereturn values. All values that are equal to "false" (ignoring case) will result infalsereturn values. All other values will return the default.- Parameters:
sStr- The string to be interpreted. May benull.bDefault- The default value to be returned if the passed string is neither "true" nor "false".- Returns:
trueorfalse:)
-
parseBoolObj
Try to interpret the passed object as boolean. This works only if the passed object is either aStringor aBoolean.- Parameters:
aObject- The object to be interpreted. May benull.- Returns:
nullif the passed object cannot be interpreted as a boolean, any otherBooleanotherwise.
-
parseBoolObj
- Parameters:
aObject- The object to be interpreted. May benull.aDefault- The default value to be returned, if the passed object isnull.- Returns:
- The passed default value if the passed object is
null, the matchingBooleanotherwise.
-
parseBoolObj
Returns aBooleanwith a value represented by the specified string. TheBooleanreturned represents atruevalue if the string argument is notnulland is equal, ignoring case, to the string"true". This method is equal toBoolean.valueOf(String)- Parameters:
sStr- The string to be parsed. May benull.- Returns:
- the
Booleanvalue represented by the string. Nevernull.
-
parseBoolObjExact
Returns aBooleanwith a value represented by the specified string. TheBooleanreturned represents atruevalue if the string argument is notnulland is equal, ignoring case, to the string"true", and it will returnfalseif the string argument is notnulland is equal, ignoring case, to the string"false". In all other casesnullis returned.- Parameters:
sStr- The string to be parsed. May benull.- Returns:
- the
Booleanvalue represented by the string. Nevernull.
-
parseBoolObjExact
public static @Nullable Boolean parseBoolObjExact(@Nullable String sStr, @Nullable Boolean aDefault) Returns aBooleanwith a value represented by the specified string. TheBooleanreturned represents atruevalue if the string argument is notnulland is equal, ignoring case, to the string"true", and it will returnfalseif the string argument is notnulland is equal, ignoring case, to the string"false". In all other casesaDefaultis returned.- Parameters:
sStr- The string to be parsed. May benull.aDefault- The default value to be returned if the value is neither "true" nor "false". May benull.- Returns:
- the
Booleanvalue represented by the string. Nevernull.
-
parseByte
- Parameters:
aObject- The Object to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseByte
Parse the givenObjectas byte with the specified radix.- Parameters:
aObject- The Object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseByte
- Parameters:
sStr- The String to parse. May benull.nDefault- The value to be returned if the string cannot be converted to a valid value.- Returns:
- The passed default parameter if the string does not represent a valid value.
-
parseByte
Parse the givenStringas byte with the specified radix.- Parameters:
sStr- The String to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The value to be returned if the string cannot be converted to a valid value.- Returns:
- The passed default parameter if the string does not represent a valid value.
-
parseByteObj
- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseByteObj
- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned, if the passed object cannot be converted. May benull.- Returns:
- the passed default value if the object does not represent a valid value.
-
parseByteObj
public static @Nullable Byte parseByteObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Byte aDefault) - Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned, if the passed object cannot be converted. May benull.- Returns:
- the passed default value if the object does not represent a valid value.
-
parseByteObj
- Parameters:
sStr- The String to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseByteObj
- Parameters:
sStr- The String to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseByteObj
public static @Nullable Byte parseByteObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Byte aDefault) - Parameters:
sStr- The String to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseDouble
Parse the givenObjectas 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).- Parameters:
aObject- The object to parse. May benull.dDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseDouble
Parse the givenStringas double.- Parameters:
sStr- The string to parse. May benull.dDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseDoubleObj
Parse the givenObjectasDouble. 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).- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseDoubleObj
Parse the givenObjectasDouble. 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).- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned if the parsed object cannot be converted to a double. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseDoubleObj
Parse the givenStringasDouble. 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).- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseDoubleObj
Parse the givenStringasDouble. 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).- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the parsed string cannot be converted to a double. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseFloat
Parse the givenObjectas 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).- Parameters:
aObject- The object to parse. May benull.fDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseFloat
Parse the givenStringas float.- Parameters:
sStr- The string to parse. May benull.fDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseFloatObj
Parse the givenObjectasFloat. 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).- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseFloatObj
Parse the givenObjectasFloat. 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).- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned if the parsed object cannot be converted to a float. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseFloatObj
Parse the givenStringasFloat. 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).- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseFloatObj
Parse the givenStringasFloat. 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).- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the parsed string cannot be converted to a float. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseInt
Parse the givenObjectas int with radixDEFAULT_RADIX.- Parameters:
aObject- The Object to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseInt
Parse the givenObjectas int with the specified radix.- Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the string does not represent a valid value.
-
parseInt
- Parameters:
sStr- The String to parse. May benull.nDefault- The value to be returned if the string cannot be converted to a valid value.- Returns:
- The passed default parameter if the string does not represent a valid value.
-
parseInt
Parse the givenStringas int with the specified radix.- Parameters:
sStr- The String to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The value to be returned if the string cannot be converted to a valid value.- Returns:
- The passed default parameter if the string does not represent a valid value.
-
parseIntObj
- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseIntObj
- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned if the passed object cannot be converted to an Integer. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseIntObj
public static @Nullable Integer parseIntObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Integer aDefault) - Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed object cannot be converted to an Integer. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseIntObj
- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseIntObj
- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseIntObj
public static @Nullable Integer parseIntObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Integer aDefault) - Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseUnsignedIntObj
- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the string does not represent a valid value.- Since:
- 9.0.0
-
parseUnsignedIntObj
- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.- Since:
- 9.0.0
-
parseUnsignedIntObj
public static @Nullable Long parseUnsignedIntObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Long aDefault) - Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.- Since:
- 9.0.0
-
parseLong
- Parameters:
aObject- The object to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseLong
Parse the givenObjectas long with the specified radix.- Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseLong
- Parameters:
sStr- The string to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default if the string does not represent a valid value.
-
parseLong
Parse the givenStringas long with the specified radix.- Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default if the string does not represent a valid value.
-
parseLongObj
- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseLongObj
- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned if the passed object cannot be converted to a Long. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseLongObj
public static @Nullable Long parseLongObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Long aDefault) - Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed object cannot be converted to a Long. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseLongObj
- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseLongObj
- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseLongObj
public static @Nullable Long parseLongObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Long aDefault) - Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseShort
- Parameters:
aObject- The object to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseShort
Parse the givenObjectas short with the specified radix.- Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default value if the object does not represent a valid value.
-
parseShort
- Parameters:
sStr- The string to parse. May benull.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default if the string does not represent a valid value.
-
parseShort
Parse the givenStringas short with the specified radix.- Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.nDefault- The default value to be returned if the passed object could not be converted to a valid value.- Returns:
- The default if the string does not represent a valid value.
-
parseShortObj
- Parameters:
aObject- The object to parse. May benull.- Returns:
nullif the object does not represent a valid value.
-
parseShortObj
- Parameters:
aObject- The object to parse. May benull.aDefault- The default value to be returned if the passed object cannot be converted to a Short. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseShortObj
public static @Nullable Short parseShortObj(@Nullable Object aObject, @Nonnegative int nRadix, @Nullable Short aDefault) - Parameters:
aObject- The object to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed object cannot be converted to a Short. May benull.- Returns:
aDefaultif the object does not represent a valid value.
-
parseShortObj
- Parameters:
sStr- The string to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseShortObj
- Parameters:
sStr- The string to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseShortObj
public static @Nullable Short parseShortObj(@Nullable String sStr, @Nonnegative int nRadix, @Nullable Short aDefault) - Parameters:
sStr- The string to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseBigInteger
- Parameters:
sStr- The String to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseBigInteger
Parse the givenStringasBigIntegerwith the specified radix.- Parameters:
sStr- The String to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.- Returns:
nullif the string does not represent a valid value.
-
parseBigInteger
public static @Nullable BigInteger parseBigInteger(@Nullable String sStr, @Nullable BigInteger aDefault) - Parameters:
sStr- The String to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseBigInteger
public static @Nullable BigInteger parseBigInteger(@Nullable String sStr, @Nonnegative int nRadix, @Nullable BigInteger aDefault) Parse the givenStringasBigIntegerwith the specified radix.- Parameters:
sStr- The String to parse. May benull.nRadix- The radix to use. Must be ≥Character.MIN_RADIXand ≤Character.MAX_RADIX.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseBigDecimal
Parse the givenStringasBigDecimal.- Parameters:
sStr- The String to parse. May benull.- Returns:
nullif the string does not represent a valid value.
-
parseBigDecimal
public static @Nullable BigDecimal parseBigDecimal(@Nullable String sStr, @Nullable BigDecimal aDefault) Parse the givenStringasBigDecimal.- Parameters:
sStr- The String to parse. May benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
parseBigDecimal
public static @Nullable BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnegative int nScale, @NonNull RoundingMode eRoundingMode) Parse the givenStringasBigDecimal.- Parameters:
sStr- The String to parse. May benull.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 benull.- Returns:
nullif the string does not represent a valid value.
-
parseBigDecimal
public static @Nullable BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnegative int nScale, @NonNull RoundingMode eRoundingMode, @Nullable BigDecimal aDefault) Parse the givenStringasBigDecimal.- Parameters:
sStr- The String to parse. May benull.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 benull.aDefault- The default value to be returned if the passed string could not be converted to a valid value. May benull.- Returns:
aDefaultif the string does not represent a valid value.
-
isInt
Checks if the given string is a numeric string that can be converted to a long value with radix 10.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-
isLong
Checks if the given string is a numeric string that can be converted to a long value with radix 10.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-
isUnsignedInt
Checks if the given string is a numeric string that can be converted to an unsigned long value with radix 10.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-
isUnsignedLong
Checks if the given string is a numeric string that can be converted to an unsigned long value with radix 10.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-
isDouble
Checks if the given string is a double string that can be converted to a double value.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-
isFloat
Checks if the given string is a float string that can be converted to a double value.- Parameters:
sStr- The string to check. May benull.- Returns:
trueif the value can be converted to a valid value
-