< prev index next >
src/java.base/share/classes/java/util/Formatter.java
Print this page
@@ -288,16 +288,18 @@
* String#toUpperCase(Locale)}
*
* <pre>
* out.toUpperCase(Locale.getDefault(Locale.Category.FORMAT)) </pre>
*
- * <table cellpadding=5 summary="genConv">
- *
+ * <table class="altrows">
+ * <caption style="display:none">genConv</caption>
+ * <thead>
* <tr><th style="vertical-align:bottom"> Conversion
* <th style="vertical-align:bottom"> Argument Category
* <th style="vertical-align:bottom"> Description
- *
+ * </thead>
+ * <tbody>
* <tr><td style="vertical-align:top"> {@code 'b'}, {@code 'B'}
* <td style="vertical-align:top"> general
* <td> If the argument <i>arg</i> is {@code null}, then the result is
* "{@code false}". If <i>arg</i> is a {@code boolean} or {@link
* Boolean}, then the result is the string returned by {@link
@@ -363,10 +365,11 @@
*
* <tr><td style="vertical-align:top">{@code 'n'}
* <td style="vertical-align:top"> line separator
* <td> The result is the platform-specific line separator
*
+ * </tbody>
* </table>
*
* <p> Any characters not explicitly defined as conversions are illegal and are
* reserved for future extensions.
*
@@ -379,12 +382,13 @@
* Java-specific functionality (e.g. {@code 'L'} for milliseconds within the
* second).
*
* <p> The following conversion characters are used for formatting times:
*
- * <table cellpadding=5 summary="time">
- *
+ * <table class="altrows">
+ * <caption style="display:none">time</caption>
+ * <tbody>
* <tr><td style="vertical-align:top"> {@code 'H'}
* <td> Hour of the day for the 24-hour clock, formatted as two digits with
* a leading zero as necessary i.e. {@code 00 - 23}.
*
* <tr><td style="vertical-align:top">{@code 'I'}
@@ -444,15 +448,18 @@
* <tr><td style="vertical-align:top">{@code 'Q'}
* <td> Milliseconds since the beginning of the epoch starting at 1 January
* 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to
* {@code Long.MAX_VALUE}.
*
+ * </tbody>
* </table>
*
* <p> The following conversion characters are used for formatting dates:
*
- * <table cellpadding=5 summary="date">
+ * <table class="altrows">
+ * <caption style="display:none">date</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code 'B'}
* <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths
* full month name}, e.g. {@code "January"}, {@code "February"}.
*
@@ -500,16 +507,19 @@
* necessary, i.e. {@code 01 - 31}
*
* <tr><td style="vertical-align:top">{@code 'e'}
* <td> Day of month, formatted as two digits, i.e. {@code 1 - 31}.
*
+ * </tbody>
* </table>
*
* <p> The following conversion characters are used for formatting common
* date/time compositions.
*
- * <table cellpadding=5 summary="composites">
+ * <table class="altrows">
+ * <caption style="display:none">composites</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code 'R'}
* <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"}
*
* <tr><td style="vertical-align:top">{@code 'T'}
@@ -529,28 +539,31 @@
*
* <tr><td style="vertical-align:top">{@code 'c'}
* <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"},
* e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}.
*
+ * </tbody>
* </table>
*
* <p> Any characters not explicitly defined as date/time conversion suffixes
* are illegal and are reserved for future extensions.
*
* <h4> Flags </h4>
*
* <p> The following table summarizes the supported flags. <i>y</i> means the
* flag is supported for the indicated argument types.
*
- * <table cellpadding=5 summary="genConv">
- *
+ * <table class="altrows">
+ * <caption style="display:none">genConv</caption>
+ * <thead>
* <tr><th style="vertical-align:bottom"> Flag <th style="vertical-align:bottom"> General
* <th style="vertical-align:bottom"> Character <th style="vertical-align:bottom"> Integral
* <th style="vertical-align:bottom"> Floating Point
* <th style="vertical-align:bottom"> Date/Time
* <th style="vertical-align:bottom"> Description
- *
+ * </thead>
+ * <tbody>
* <tr><td> '-' <td style="text-align:center; vertical-align:top"> y
* <td style="text-align:center; vertical-align:top"> y
* <td style="text-align:center; vertical-align:top"> y
* <td style="text-align:center; vertical-align:top"> y
* <td style="text-align:center; vertical-align:top"> y
@@ -597,10 +610,11 @@
* <td style="text-align:center; vertical-align:top"> y<sup>4</sup>
* <td style="text-align:center; vertical-align:top"> y<sup>5</sup>
* <td style="text-align:center"> -
* <td> The result will enclose negative numbers in parentheses
*
+ * </tbody>
* </table>
*
* <p> <sup>1</sup> Depends on the definition of {@link Formattable}.
*
* <p> <sup>2</sup> For {@code 'd'} conversion only.
@@ -703,11 +717,13 @@
*
* <h4><a id="dgen">General</a></h4>
*
* <p> The following general conversions may be applied to any argument type:
*
- * <table cellpadding=5 summary="dgConv">
+ * <table class="altrows">
+ * <caption style="display:none">dgConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'b'}
* <td style="vertical-align:top"> <code>'\u0062'</code>
* <td> Produces either "{@code true}" or "{@code false}" as returned by
* {@link Boolean#toString(boolean)}.
@@ -754,15 +770,18 @@
*
* <tr><td style="vertical-align:top"> {@code 'S'}
* <td style="vertical-align:top"> <code>'\u0053'</code>
* <td> The upper-case variant of {@code 's'}.
*
+ * </tbody>
* </table>
*
* <p> The following <a id="dFlags">flags</a> apply to general conversions:
*
- * <table cellpadding=5 summary="dFlags">
+ * <table class="altrows">
+ * <caption style="display:none">dFlags</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code '-'}
* <td style="vertical-align:top"> <code>'\u002d'</code>
* <td> Left justifies the output. Spaces (<code>'\u0020'</code>) will be
* added at the end of the converted value as required to fill the minimum
@@ -773,10 +792,11 @@
* <tr><td style="vertical-align:top"> {@code '#'}
* <td style="vertical-align:top"> <code>'\u0023'</code>
* <td> Requires the output use an alternate form. The definition of the
* form is specified by the conversion.
*
+ * </tbody>
* </table>
*
* <p> The <a id="genWidth">width</a> is the minimum number of characters to
* be written to the
* output. If the length of the converted value is less than the width then
@@ -799,11 +819,13 @@
* {@code short}, and {@link Short}, {@code int} and {@link Integer} when
* {@link Character#isValidCodePoint} returns {@code true}. If it returns
* {@code false} then an {@link IllegalFormatCodePointException} will be
* thrown.
*
- * <table cellpadding=5 summary="charConv">
+ * <table class="altrows">
+ * <caption style="display:none">charConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'c'}
* <td style="vertical-align:top"> <code>'\u0063'</code>
* <td> Formats the argument as a Unicode character as described in <a
* href="../lang/Character.html#unicode">Unicode Character
@@ -815,10 +837,11 @@
*
* <tr><td style="vertical-align:top"> {@code 'C'}
* <td style="vertical-align:top"> <code>'\u0043'</code>
* <td> The upper-case variant of {@code 'c'}.
*
+ * </tbody>
* </table>
*
* <p> The {@code '-'} flag defined for <a href="#dFlags">General
* conversions</a> applies. If the {@code '#'} flag is given, then a {@link
* FormatFlagsConversionMismatchException} will be thrown.
@@ -900,11 +923,13 @@
*
* <p> The following conversions may be applied to {@code byte}, {@link Byte},
* {@code short}, {@link Short}, {@code int} and {@link Integer},
* {@code long}, and {@link Long}.
*
- * <table cellpadding=5 summary="IntConv">
+ * <table class="altrows">
+ * <caption style="display:none">IntConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'd'}
* <td style="vertical-align:top"> <code>'\u0064'</code>
* <td> Formats the argument as a decimal integer. The <a
* href="#L10nAlgorithm">localization algorithm</a> is applied.
@@ -966,10 +991,11 @@
* representing the number will be converted to {@linkplain
* String#toUpperCase upper case} including the {@code 'x'} (if any) and
* all hexadecimal digits {@code 'a'} - {@code 'f'}
* (<code>'\u0061'</code> - <code>'\u0066'</code>).
*
+ * </tbody>
* </table>
*
* <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and
* both the {@code '#'} and the {@code '0'} flags are given, then result will
* contain the radix indicator ({@code '0'} for octal and {@code "0x"} or
@@ -980,11 +1006,13 @@
* before the sign.
*
* <p> The following <a id="intFlags">flags</a> apply to numeric integral
* conversions:
*
- * <table cellpadding=5 summary="intFlags">
+ * <table class="altrows">
+ * <caption style="display:none">intFlags</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code '+'}
* <td style="vertical-align:top"> <code>'\u002b'</code>
* <td> Requires the output to include a positive sign for all positive
* numbers. If this flag is not given then only negative values will
@@ -1023,10 +1051,11 @@
* <td style="vertical-align:top"> <code>'\u0028'</code>
* <td> Requires the output to prepend a {@code '('}
* (<code>'\u0028'</code>) and append a {@code ')'}
* (<code>'\u0029'</code>) to negative values.
*
+ * </tbody>
* </table>
*
* <p> If no <a id="intdFlags">flags</a> are given the default formatting is
* as follows:
*
@@ -1058,11 +1087,13 @@
* <p><a id="dnbint"><b> BigInteger </b></a>
*
* <p> The following conversions may be applied to {@link
* java.math.BigInteger}.
*
- * <table cellpadding=5 summary="BIntConv">
+ * <table class="altrows">
+ * <caption style="display:none">bIntConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'd'}
* <td style="vertical-align:top"> <code>'\u0064'</code>
* <td> Requires the output to be formatted as a decimal integer. The <a
* href="#L10nAlgorithm">localization algorithm</a> is applied.
@@ -1123,10 +1154,11 @@
* representing the number will be converted to {@linkplain
* String#toUpperCase upper case} including the {@code 'x'} (if any) and
* all hexadecimal digits {@code 'a'} - {@code 'f'}
* (<code>'\u0061'</code> - <code>'\u0066'</code>).
*
+ * </tbody>
* </table>
*
* <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and
* both the {@code '#'} and the {@code '0'} flags are given, then result will
* contain the base indicator ({@code '0'} for octal and {@code "0x"} or
@@ -1152,11 +1184,13 @@
* <p><a id="dndec"><b> Float and Double</b></a>
*
* <p> The following conversions may be applied to {@code float}, {@link
* Float}, {@code double} and {@link Double}.
*
- * <table cellpadding=5 summary="floatConv">
+ * <table class="altrows">
+ * <caption style="display:none">floatConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'e'}
* <td style="vertical-align:top"> <code>'\u0065'</code>
* <td> Requires the output to be formatted using <a
* id="scientific">computerized scientific notation</a>. The <a
@@ -1329,10 +1363,11 @@
* representing the number will be converted to upper case including the
* {@code 'x'} (<code>'\u0078'</code>) and {@code 'p'}
* (<code>'\u0070'</code> and all hexadecimal digits {@code 'a'} -
* {@code 'f'} (<code>'\u0061'</code> - <code>'\u0066'</code>).
*
+ * </tbody>
* </table>
*
* <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and
* Long apply.
*
@@ -1386,11 +1421,13 @@
* <p><a id="dnbdec"><b> BigDecimal </b></a>
*
* <p> The following conversions may be applied {@link java.math.BigDecimal
* BigDecimal}.
*
- * <table cellpadding=5 summary="floatConv">
+ * <table class="altrows">
+ * <caption style="display:none">floatConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'e'}
* <td style="vertical-align:top"> <code>'\u0065'</code>
* <td> Requires the output to be formatted using <a
* id="bscientific">computerized scientific notation</a>. The <a
@@ -1490,10 +1527,11 @@
* {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
* algorithm}. Otherwise, zeros may be appended to reach the precision.
* For a canonical representation of the value, use {@link
* BigDecimal#toString()}.
*
+ * </tbody>
* </table>
*
* <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and
* Long apply.
*
@@ -1510,19 +1548,22 @@
* <h4><a id="ddt">Date/Time</a></h4>
*
* <p> This conversion may be applied to {@code long}, {@link Long}, {@link
* Calendar}, {@link Date} and {@link TemporalAccessor TemporalAccessor}
*
- * <table cellpadding=5 summary="DTConv">
+ * <table class="altrows">
+ * <caption style="display:none">DTConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 't'}
* <td style="vertical-align:top"> <code>'\u0074'</code>
* <td> Prefix for date and time conversion characters.
* <tr><td style="vertical-align:top"> {@code 'T'}
* <td style="vertical-align:top"> <code>'\u0054'</code>
* <td> The upper-case variant of {@code 't'}.
*
+ * </tbody>
* </table>
*
* <p> The following date and time conversion character suffixes are defined
* for the {@code 't'} and {@code 'T'} conversions. The types are similar to
* but not completely identical to those defined by GNU {@code date} and
@@ -1530,11 +1571,13 @@
* access Java-specific functionality (e.g. {@code 'L'} for milliseconds
* within the second).
*
* <p> The following conversion characters are used for formatting times:
*
- * <table cellpadding=5 summary="time">
+ * <table class="altrows">
+ * <caption style="display:none">time</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top"> {@code 'H'}
* <td style="vertical-align:top"> <code>'\u0048'</code>
* <td> Hour of the day for the 24-hour clock, formatted as two digits with
* a leading zero as necessary i.e. {@code 00 - 23}. {@code 00}
@@ -1618,15 +1661,18 @@
* <td> Milliseconds since the beginning of the epoch starting at 1 January
* 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to
* {@code Long.MAX_VALUE}. The precision of this value is limited by
* the resolution of the underlying operating system or hardware.
*
+ * </tbody>
* </table>
*
* <p> The following conversion characters are used for formatting dates:
*
- * <table cellpadding=5 summary="date">
+ * <table class="altrows">
+ * <caption style="display:none">date</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code 'B'}
* <td style="vertical-align:top"> <code>'\u0042'</code>
* <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths
* full month name}, e.g. {@code "January"}, {@code "February"}.
@@ -1690,16 +1736,19 @@
* <tr><td style="vertical-align:top">{@code 'e'}
* <td style="vertical-align:top"> <code>'\u0065'</code>
* <td> Day of month, formatted as two digits, i.e. {@code 1 - 31} where
* "{@code 1}" is the first day of the month.
*
+ * </tbody>
* </table>
*
* <p> The following conversion characters are used for formatting common
* date/time compositions.
*
- * <table cellpadding=5 summary="composites">
+ * <table class="altrows">
+ * <caption style="display:none">composites</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code 'R'}
* <td style="vertical-align:top"> <code>'\u0052'</code>
* <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"}
*
@@ -1725,10 +1774,11 @@
* <tr><td style="vertical-align:top">{@code 'c'}
* <td style="vertical-align:top"> <code>'\u0063'</code>
* <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"},
* e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}.
*
+ * </tbody>
* </table>
*
* <p> The {@code '-'} flag defined for <a href="#dFlags">General
* conversions</a> applies. If the {@code '#'} flag is given, then a {@link
* FormatFlagsConversionMismatchException} will be thrown.
@@ -1746,11 +1796,13 @@
*
* <h4><a id="dper">Percent</a></h4>
*
* <p> The conversion does not correspond to any argument.
*
- * <table cellpadding=5 summary="DTConv">
+ * <table class="altrows">
+ * <caption style="display:none">DTConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code '%'}
* <td> The result is a literal {@code '%'} (<code>'\u0025'</code>)
*
* <p> The width is the minimum number of characters to
@@ -1765,22 +1817,26 @@
* {@link FormatFlagsConversionMismatchException} will be thrown.
*
* <p> The precision is not applicable. If the precision is specified an
* {@link IllegalFormatPrecisionException} will be thrown.
*
+ * </tbody>
* </table>
*
* <h4><a id="dls">Line Separator</a></h4>
*
* <p> The conversion does not correspond to any argument.
*
- * <table cellpadding=5 summary="DTConv">
+ * <table class="altrows">
+ * <caption style="display:none">DTConv</caption>
+ * <tbody>
*
* <tr><td style="vertical-align:top">{@code 'n'}
* <td> the platform-specific line separator as returned by {@link
* System#lineSeparator()}.
*
+ * </tbody>
* </table>
*
* <p> Flags, width, and precision are not applicable. If any are provided an
* {@link IllegalFormatFlagsException}, {@link IllegalFormatWidthException},
* and {@link IllegalFormatPrecisionException}, respectively will be thrown.
< prev index next >