Sunday, 25 August 2013

Parsing a string with NumberFormat

Parsing a string with NumberFormat

From the this java API
parse
public abstract Number parse(String source, ParsePosition parsePosition)
Returns a Long if possible (e.g., within the range [Long.MIN_VALUE,
Long.MAX_VALUE] and with no decimals), otherwise a Double. If IntegerOnly
is set, will stop at a decimal point (or equivalent; e.g., for rational
numbers "1 2/3", will stop after the 1). Does not throw an exception; if
no object can be parsed, index is unchanged!
(or equivalent; e.g., for rational numbers "1 2/3", will stop after the 1)
What are they talkng about? is it something possible at all parsing such a
String? However I have tried also with setParseIntegerOnly(false); and it
parses only 1. What did they mean with that statement that I must have
missed? Thanks in advance.

No comments:

Post a Comment