No method will throw any sort of Exception when parsing a string. All methods accept any Java String or null as legal input, if the input is non null, whitespace will be trimmed first, and then parsing will be attempted.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Float | Returns: The Float represented by the String, or null if it could not be parsed.the String to parse str)Parse a Float from a String without exceptions. |
| public static float | parseFloat(final String str, final float
the value to return if the String cannot be parsed def)Parse a float from a String, with a default value |
| public static Integer | |
| public static Long | |
| public static long |
| NumberParser | back to summary |
|---|---|
| private NumberParser() Private constructor to avoid NumberParser instances creation. | |
| parseFloat | back to summary |
|---|---|
| public static Float parseFloat(final String str) Parse a Float from a String without exceptions. If the String is not a Float then null is returned | |
| parseFloat | back to summary |
|---|---|
| public static float parseFloat(final String str, final float def) Parse a float from a String, with a default value
| |
| parseInt | back to summary |
|---|---|
| public static Integer parseInt(final String str) Parse an Integer from a String. If the String is not an integer null is returned and no exception is thrown. | |
| parseLong | back to summary |
|---|---|
| public static Long parseLong(final String str) Parses a Long out of a string. | |
| parseLong | back to summary |
|---|---|
| public static long parseLong(final String str, final long def) Parses a long out of a string.
| |