From 684b91efbb22f16cd0952283e8c960846c39d1db Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Thu, 19 Oct 2023 22:53:07 +0000 Subject: [PATCH] 8315064: j.text.ChoiceFormat provides no specification on quoting behavior Reviewed-by: naoto --- src/java.base/share/classes/java/text/ChoiceFormat.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/java.base/share/classes/java/text/ChoiceFormat.java b/src/java.base/share/classes/java/text/ChoiceFormat.java index ed49b11bd45..538454d669a 100644 --- a/src/java.base/share/classes/java/text/ChoiceFormat.java +++ b/src/java.base/share/classes/java/text/ChoiceFormat.java @@ -187,6 +187,12 @@ import java.util.Arrays; * * Note:The relation ≤ is not equivalent to <= * + *

If a Relation symbol is to be used within a Format pattern, + * it must be single quoted. For example, + * {@code new ChoiceFormat("1# '#'1 ").format(1)} returns {@code " #1 "}. + * Use two single quotes in a row to produce a literal single quote. For example, + * {@code new ChoiceFormat("1# ''one'' ").format(1)} returns {@code " 'one' "}. + * *

Below is an example of constructing a ChoiceFormat with a pattern: *

* {@snippet lang=java :