|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.croftsoft.core.text.ParseLib
public final class ParseLib
A collection of static methods to parse primitive types.
Method Summary | |
---|---|
static void |
main(String[] args)
|
static boolean |
parseBoolean(String s,
boolean backup)
Parses a boolean value from a String. |
static double |
parseDouble(String s,
double backup)
Parses a double out of a String. |
static int |
parseInt(String s,
int backup)
Returns backup if s is null or a NumberFormatException occurs. |
static long |
parseLong(String s,
long backup)
Returns backup if s is null or a NumberFormatException occurs. |
static String |
stripNonNumbers(String s)
Strips non-number characters out of the String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void main(String[] args)
public static boolean parseBoolean(String s, boolean backup)
All leading and trailing whitespace is trimmed and all characters are converted to lower case before the comparison.
backup
- Default value to be returned is s is null or cannot be parsed.
public static double parseDouble(String s, double backup)
backup
- Default value returned if unable to parse the String.public static int parseInt(String s, int backup)
public static long parseLong(String s, long backup)
public static String stripNonNumbers(String s)
Example: "$1,999.99 or best offer" ==> "1999.99"
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |