Skip to content

Commit dcf1523

Browse files
Justin Lunaotoj
Justin Lu
authored andcommitted
8300077: Refactor code examples to use @snippet in java.text.ChoiceFormat
Reviewed-by: lancea, iris, naoto
1 parent d117350 commit dcf1523

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/java.base/share/classes/java/text/ChoiceFormat.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
* <p>
8686
* Here is a simple example that shows formatting and parsing:
8787
* <blockquote>
88-
* <pre>{@code
88+
* {@snippet lang=java :
8989
* double[] limits = {1,2,3,4,5,6,7};
9090
* String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
9191
* ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
@@ -95,11 +95,11 @@
9595
* System.out.println(i + " -> " + form.format(i) + " -> "
9696
* + form.parse(form.format(i),status));
9797
* }
98-
* }</pre>
98+
* }
9999
* </blockquote>
100100
* Here is a more complex example, with a pattern format:
101101
* <blockquote>
102-
* <pre>{@code
102+
* {@snippet lang=java :
103103
* double[] filelimits = {0,1,2};
104104
* String[] filepart = {"are no files","is one file","are {2} files"};
105105
* ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
@@ -112,13 +112,13 @@
112112
* testArgs[2] = testArgs[0];
113113
* System.out.println(pattform.format(testArgs));
114114
* }
115-
* }</pre>
115+
* }
116116
* </blockquote>
117117
* <p>
118118
* Specifying a pattern for ChoiceFormat objects is fairly straightforward.
119119
* For example:
120120
* <blockquote>
121-
* <pre>{@code
121+
* {@snippet lang=java :
122122
* ChoiceFormat fmt = new ChoiceFormat(
123123
* "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more than 2.");
124124
* System.out.println("Formatter Pattern : " + fmt.toPattern());
@@ -133,7 +133,7 @@
133133
* System.out.println("Format with 2.1 : " + fmt.format(2.1));
134134
* System.out.println("Format with NaN : " + fmt.format(Double.NaN));
135135
* System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));
136-
* }</pre>
136+
* }
137137
* </blockquote>
138138
* And the output result would be like the following:
139139
* <blockquote>

0 commit comments

Comments
 (0)