September 2019
Intermediate to advanced
816 pages
18h 47m
English
Parsing is the reverse process of formatting. We have a given string and try to parse it as a number. This can be accomplished via the NumberFormat.parse() method. By default, parsing doesn't take advantage of grouping (for example, without grouping, 5,50 K is parsed as 5; with grouping, 5,50 K is parsed as 550000).
If we condense this information into a set of helper methods, then we obtain the following output:
public static Number parseLocale(Locale locale, String number) throws ParseException { return parse(locale, Style.SHORT, false, number);}public static Number parseLocaleStyle( Locale locale, Style style, String number) throws ParseException { return parse(locale, style, false, number);}public static Number parseLocaleStyleRound( ...