|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jnario.lib.StringConversions
public class StringConversions
Jnario extensions to convert string values into other formats.
Useful when converting StepArguments.
| Constructor Summary | |
|---|---|
StringConversions()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringConversions()
| Method Detail |
|---|
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
#parseInt(java.lang.String, int) method.
s - a String containing the int
representation to be parsed
NumberFormatException - 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 #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 parsed
long 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.
public static List<String> toList(String s)
List.
s - a list with comma separated values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||