Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.syndication.io.impl
Class NumberParser

    java.lang.Object
      com.sun.syndication.io.impl.NumberParser

    public class NumberParser

extends Object

A helper class that parses Numbers out of Strings in a lenient manner.

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.

:TODO: Add Integer, Float, and Double methods as needed.

Method Summary
`static Float` | `parseFloat(String str)` Parse a Float from a String without exceptions.
`static float` | `parseFloat(String str, float def)` Parse a float from a String, with a default value
`static Integer` | `parseInt(String str)` Parse an Integer from a String.
`static Long` | `parseLong(String str)` Parses a Long out of a string.
`static long` | `parseLong(String str, long def)` Parses a long out of a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### parseLong

    public static Long parseLong(String str)

  Parses a Long out of a string.

  Parameters:
    `str` - string to parse for a Long.
  Returns:
    the Long represented by the given string, It returns null if it was not possible to parse the the string.

### parseInt

    public static Integer parseInt(String str)

  Parse an Integer from a String. If the String is not an integer null is returned and no exception is thrown.

  Parameters:
    `str` - the String to parse
  Returns:
    The Integer represented by the String, or null if it could not be parsed.

### parseFloat

    public static Float parseFloat(String str)

  Parse a Float from a String without exceptions. If the String is not a Float then null is returned

  Parameters:
    `str` - the String to parse
  Returns:
    The Float represented by the String, or null if it could not be parsed.

### parseFloat

    public static float parseFloat(String str,
                                   float def)

  Parse a float from a String, with a default value

  Parameters:
    `str` -
    `def` - the value to return if the String cannot be parsed
  Returns:

### parseLong

    public static long parseLong(String str,
                                 long def)

  Parses a long out of a string.

  Parameters:
    `str` - string to parse for a long.
    `def` - default value to return if it is not possible to parse the the string.
  Returns:
    the long represented by the given string, or the default.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2013 ROME Project. All Rights Reserved.