j.text.ChoiceFormat provides no specification on quoting behavior

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 22
    • Affects Version/s: None
    • Component/s: core-libs
    • b21
    • generic
    • generic

      java.text.ChoiceFormat provides the ability to quote values within the String pattern but does not make it apparent or explain the behavior in the API docs.

      For example,

      var cf = new ChoiceFormat(" 1#'example' ");
      var otherCf = new ChoiceFormat(" 1#example ");
      cf.format(1) == otherCf.format(1); // returns true

      or

      var cf = new ChoiceFormat(" 1#'#' "); // works
      var cf = new ChoiceFormat(" 1## "); // throws an exception

      The single quotes can be used to escape the values of "#", "<", "≤" and "|" which are usually recognized as special characters by ChoiceFormat otherwise. The other Format classes such as Decimal, CompactNumber, and Message all provide specification on single quotes within a pattern; choiceFormat should as well.



            Assignee:
            Justin Lu
            Reporter:
            Justin Lu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: