public class StringConversions extends Object
StepArguments.| Constructor and Description |
|---|
StringConversions() |
| Modifier and Type | Method and Description |
|---|---|
static BigDecimal |
toBigDecimal(String s)
Translates the string representation of a
BigDecimal
into a BigDecimal. |
static boolean |
toBool(String s)
Returns a
Boolean with a value represented by the
specified string. |
static double |
toDouble(String s)
Returns a new
double initialized to the value
represented by the specified String, as performed
by the valueOf method of class
Double. |
static int |
toInt(String s)
Parses the string argument as a signed decimal integer.
|
static List<String> |
toList(String s)
Convert a comma separated value string into a
List. |
static long |
toLong(String s)
Parses the string argument as a signed decimal
long. |
public static int toInt(String s)
'-'
('\u002D') to indicate a negative value. The resulting
integer value is returned, exactly as if the argument and the radix
10 were given as arguments to the Integer.parseInt(java.lang.String, int) method.s - a String containing the int
representation to be parsedNumberFormatException - if the string does not contain a
parsable integer.Integer.parseInt(String)public static long toLong(String s)
long. The characters in the string must all be
decimal digits, except that the first character may be an ASCII
minus sign '-' (\u002D') to
indicate a negative value. The resulting long
value is returned, exactly as if the argument and the radix
10 were given as arguments to the Long.parseLong(java.lang.String, int) method.
Note that neither the character L
('\u004C') nor l
('\u006C') is permitted to appear at the end
of the string as a type indicator, as would be permitted in
Java programming language source code.
s - a String containing the long
representation to be parsedlong represented by the argument in
decimal.NumberFormatException - if the string does not contain a
parsable long.Long.parseLong(String)public static double toDouble(String s)
double initialized to the value
represented by the specified String, as performed
by the valueOf method of class
Double.s - the string to be parsed.double value represented by the string
argument.NumberFormatException - if the string does not contain
a parsable double.Double.parseDouble(String)public static boolean toBool(String s)
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".s - a string.Boolean value represented by the string.Boolean.parseBoolean(String)public static BigDecimal toBigDecimal(String s)
BigDecimal
into a BigDecimal. The string representation consists
of an optional sign, '+' ( '\u002B') or
'-' ('\u002D'), followed by a sequence of
zero or more decimal digits ("the integer"), optionally
followed by a fraction, optionally followed by an exponent.Copyright © 2012-2014 BMW Car IT. All Rights Reserved.