When running the attached program, I get this output:
/java/re/jdk/1.4/archive/fcs/binaries/solsparc/bin/java SetParseIntegerOnlyForPercent
java.text.ParseException: Unparseable number: "109.5%"
1.09
That is, calling the NumberFormat method setParseIntegerOnly() with TRUE and attempting to parse a percent amount with a fractional part throws a ParseException. However, parsing a percent amount with no fractional part does seem to work, even though I would have expected "1" (instead of "1.09") as the parse result.
/java/re/jdk/1.4/archive/fcs/binaries/solsparc/bin/java SetParseIntegerOnlyForPercent
java.text.ParseException: Unparseable number: "109.5%"
1.09
That is, calling the NumberFormat method setParseIntegerOnly() with TRUE and attempting to parse a percent amount with a fractional part throws a ParseException. However, parsing a percent amount with no fractional part does seem to work, even though I would have expected "1" (instead of "1.09") as the parse result.
- duplicates
-
JDK-8333755 NumberFormat integer only parsing breaks when format has suffix
- Closed