Details

    • Type: CSR
    • Status: Draft
    • Priority: P4
    • Resolution: Unresolved
    • Fix Version/s: tbd_major
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Adding support for the short number formatting in JDK.

      Problem

      The existing NumberFormat APIs provide support for formatting/parsing general purpose numbers e.g. decimal, currency, and percentage, but the support for formatting in compact forms of numbers is not available.

      Solution

      Add the support for formatting the numbers in compact forms. Each locale has different compact forms for representing a number, hence a number can be formatted in multiple ways across locales.

      For Example:

      • 1000 can be formatted as 1K, and 1000000 as 1M in "en_US" locale
      • 1000 can be formatted as 1 हज़ार, and 50000000 as 5 क'.' In "hi_IN" locale

      CLDR provides patterns for compact number formatting. These resources can be utilized to add locale specific compact number formatting support.

      Following major public APIs are introduced for compact number formatting feature:

      CompactDecimalFormat class targeted for compact number formatting

      public class CompactDecimalFormat extends DecimalFormat

      CompactDecimalFormat.Style enum for specifying the format style

      public static enum CompactDecimalFormat.Style

      Provider method in java/text/spi/NumberFormatProvider

       public NumberFormat getCompactNumberInstance(Locale, Style)

      Specification

      http://cr.openjdk.java.net/~nishjain/8177552/specdiff/specdiff.06/overview-summary.html

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              nishjain Nishit Jain
              Reporter:
              naoto Naoto Sato
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: