Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8363972 Lenient parsing of minus sign pattern in DecimalFormat/CompactNumberFormat
  3. JDK-8366216

Release Note: Lenient parsing of minus sign pattern in DecimalFormat/CompactNumberFormat

XMLWordPrintable

    • generic
    • generic

      `java.text.NumberFormat` now supports lenient parsing of minus signs in negative patterns when `NumberFormat.isStrict()` returns `false`. This behavior is enabled by default and can be disabled with `NumberFormat.setStrict(true)`. When lenient, the concrete implementations, `DecimalFormat` and `CompactNumberFormat`, use CLDR's [`parseLenient`](https://unicode.org/reports/tr35/tr35-general.html#Character_Parse_Lenient) data to recognize alternate minus signs. For example, text using the `MINUS SIGN (U+2212)` as the negative prefix is now correctly parsed:
      ```
      jshell> var num = NumberFormat.getNumberInstance().parse("\u22123")
      num ==> -3
      ```

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: