Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8333755 NumberFormat integer only parsing breaks when format has suffix
  3. JDK-8334438

Release Note: NumberFormat Supports IntegerOnly Parsing With Suffix

XMLWordPrintable

      `DecimalFormat`, when the format expects a suffix, now parses correctly when the parse value contains a decimal symbol and `isParseIntegerOnly()` would return `true`. Previously, parsing would fail for such cases and the correct value never returned.

      For example, in the following snippet, 5 will now be returned by the `parse(String)` invocation, instead of a `ParseException` thrown.

      ```
          NumberFormat fmt = NumberFormat.getPercentInstance(Locale.US);
          fmt.setParseIntegerOnly(true);
          fmt.parse("500.55%");
      ```

            jlu Justin Lu
            jlu Justin Lu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: