1 /* |
1 /* |
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
288 * String#toUpperCase(Locale)} |
288 * String#toUpperCase(Locale)} |
289 * |
289 * |
290 * <pre> |
290 * <pre> |
291 * out.toUpperCase(Locale.getDefault(Locale.Category.FORMAT)) </pre> |
291 * out.toUpperCase(Locale.getDefault(Locale.Category.FORMAT)) </pre> |
292 * |
292 * |
293 * <table cellpadding=5 summary="genConv"> |
293 * <table class="striped"> |
294 * |
294 * <caption style="display:none">genConv</caption> |
|
295 * <thead> |
295 * <tr><th style="vertical-align:bottom"> Conversion |
296 * <tr><th style="vertical-align:bottom"> Conversion |
296 * <th style="vertical-align:bottom"> Argument Category |
297 * <th style="vertical-align:bottom"> Argument Category |
297 * <th style="vertical-align:bottom"> Description |
298 * <th style="vertical-align:bottom"> Description |
298 * |
299 * </thead> |
|
300 * <tbody> |
299 * <tr><td style="vertical-align:top"> {@code 'b'}, {@code 'B'} |
301 * <tr><td style="vertical-align:top"> {@code 'b'}, {@code 'B'} |
300 * <td style="vertical-align:top"> general |
302 * <td style="vertical-align:top"> general |
301 * <td> If the argument <i>arg</i> is {@code null}, then the result is |
303 * <td> If the argument <i>arg</i> is {@code null}, then the result is |
302 * "{@code false}". If <i>arg</i> is a {@code boolean} or {@link |
304 * "{@code false}". If <i>arg</i> is a {@code boolean} or {@link |
303 * Boolean}, then the result is the string returned by {@link |
305 * Boolean}, then the result is the string returned by {@link |
363 * |
365 * |
364 * <tr><td style="vertical-align:top">{@code 'n'} |
366 * <tr><td style="vertical-align:top">{@code 'n'} |
365 * <td style="vertical-align:top"> line separator |
367 * <td style="vertical-align:top"> line separator |
366 * <td> The result is the platform-specific line separator |
368 * <td> The result is the platform-specific line separator |
367 * |
369 * |
|
370 * </tbody> |
368 * </table> |
371 * </table> |
369 * |
372 * |
370 * <p> Any characters not explicitly defined as conversions are illegal and are |
373 * <p> Any characters not explicitly defined as conversions are illegal and are |
371 * reserved for future extensions. |
374 * reserved for future extensions. |
372 * |
375 * |
379 * Java-specific functionality (e.g. {@code 'L'} for milliseconds within the |
382 * Java-specific functionality (e.g. {@code 'L'} for milliseconds within the |
380 * second). |
383 * second). |
381 * |
384 * |
382 * <p> The following conversion characters are used for formatting times: |
385 * <p> The following conversion characters are used for formatting times: |
383 * |
386 * |
384 * <table cellpadding=5 summary="time"> |
387 * <table class="striped"> |
385 * |
388 * <caption style="display:none">time</caption> |
|
389 * <tbody> |
386 * <tr><td style="vertical-align:top"> {@code 'H'} |
390 * <tr><td style="vertical-align:top"> {@code 'H'} |
387 * <td> Hour of the day for the 24-hour clock, formatted as two digits with |
391 * <td> Hour of the day for the 24-hour clock, formatted as two digits with |
388 * a leading zero as necessary i.e. {@code 00 - 23}. |
392 * a leading zero as necessary i.e. {@code 00 - 23}. |
389 * |
393 * |
390 * <tr><td style="vertical-align:top">{@code 'I'} |
394 * <tr><td style="vertical-align:top">{@code 'I'} |
444 * <tr><td style="vertical-align:top">{@code 'Q'} |
448 * <tr><td style="vertical-align:top">{@code 'Q'} |
445 * <td> Milliseconds since the beginning of the epoch starting at 1 January |
449 * <td> Milliseconds since the beginning of the epoch starting at 1 January |
446 * 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to |
450 * 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to |
447 * {@code Long.MAX_VALUE}. |
451 * {@code Long.MAX_VALUE}. |
448 * |
452 * |
|
453 * </tbody> |
449 * </table> |
454 * </table> |
450 * |
455 * |
451 * <p> The following conversion characters are used for formatting dates: |
456 * <p> The following conversion characters are used for formatting dates: |
452 * |
457 * |
453 * <table cellpadding=5 summary="date"> |
458 * <table class="striped"> |
|
459 * <caption style="display:none">date</caption> |
|
460 * <tbody> |
454 * |
461 * |
455 * <tr><td style="vertical-align:top">{@code 'B'} |
462 * <tr><td style="vertical-align:top">{@code 'B'} |
456 * <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths |
463 * <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths |
457 * full month name}, e.g. {@code "January"}, {@code "February"}. |
464 * full month name}, e.g. {@code "January"}, {@code "February"}. |
458 * |
465 * |
500 * necessary, i.e. {@code 01 - 31} |
507 * necessary, i.e. {@code 01 - 31} |
501 * |
508 * |
502 * <tr><td style="vertical-align:top">{@code 'e'} |
509 * <tr><td style="vertical-align:top">{@code 'e'} |
503 * <td> Day of month, formatted as two digits, i.e. {@code 1 - 31}. |
510 * <td> Day of month, formatted as two digits, i.e. {@code 1 - 31}. |
504 * |
511 * |
|
512 * </tbody> |
505 * </table> |
513 * </table> |
506 * |
514 * |
507 * <p> The following conversion characters are used for formatting common |
515 * <p> The following conversion characters are used for formatting common |
508 * date/time compositions. |
516 * date/time compositions. |
509 * |
517 * |
510 * <table cellpadding=5 summary="composites"> |
518 * <table class="striped"> |
|
519 * <caption style="display:none">composites</caption> |
|
520 * <tbody> |
511 * |
521 * |
512 * <tr><td style="vertical-align:top">{@code 'R'} |
522 * <tr><td style="vertical-align:top">{@code 'R'} |
513 * <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"} |
523 * <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"} |
514 * |
524 * |
515 * <tr><td style="vertical-align:top">{@code 'T'} |
525 * <tr><td style="vertical-align:top">{@code 'T'} |
529 * |
539 * |
530 * <tr><td style="vertical-align:top">{@code 'c'} |
540 * <tr><td style="vertical-align:top">{@code 'c'} |
531 * <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, |
541 * <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, |
532 * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. |
542 * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. |
533 * |
543 * |
|
544 * </tbody> |
534 * </table> |
545 * </table> |
535 * |
546 * |
536 * <p> Any characters not explicitly defined as date/time conversion suffixes |
547 * <p> Any characters not explicitly defined as date/time conversion suffixes |
537 * are illegal and are reserved for future extensions. |
548 * are illegal and are reserved for future extensions. |
538 * |
549 * |
539 * <h4> Flags </h4> |
550 * <h4> Flags </h4> |
540 * |
551 * |
541 * <p> The following table summarizes the supported flags. <i>y</i> means the |
552 * <p> The following table summarizes the supported flags. <i>y</i> means the |
542 * flag is supported for the indicated argument types. |
553 * flag is supported for the indicated argument types. |
543 * |
554 * |
544 * <table cellpadding=5 summary="genConv"> |
555 * <table class="striped"> |
545 * |
556 * <caption style="display:none">genConv</caption> |
|
557 * <thead> |
546 * <tr><th style="vertical-align:bottom"> Flag <th style="vertical-align:bottom"> General |
558 * <tr><th style="vertical-align:bottom"> Flag <th style="vertical-align:bottom"> General |
547 * <th style="vertical-align:bottom"> Character <th style="vertical-align:bottom"> Integral |
559 * <th style="vertical-align:bottom"> Character <th style="vertical-align:bottom"> Integral |
548 * <th style="vertical-align:bottom"> Floating Point |
560 * <th style="vertical-align:bottom"> Floating Point |
549 * <th style="vertical-align:bottom"> Date/Time |
561 * <th style="vertical-align:bottom"> Date/Time |
550 * <th style="vertical-align:bottom"> Description |
562 * <th style="vertical-align:bottom"> Description |
551 * |
563 * </thead> |
|
564 * <tbody> |
552 * <tr><td> '-' <td style="text-align:center; vertical-align:top"> y |
565 * <tr><td> '-' <td style="text-align:center; vertical-align:top"> y |
553 * <td style="text-align:center; vertical-align:top"> y |
566 * <td style="text-align:center; vertical-align:top"> y |
554 * <td style="text-align:center; vertical-align:top"> y |
567 * <td style="text-align:center; vertical-align:top"> y |
555 * <td style="text-align:center; vertical-align:top"> y |
568 * <td style="text-align:center; vertical-align:top"> y |
556 * <td style="text-align:center; vertical-align:top"> y |
569 * <td style="text-align:center; vertical-align:top"> y |
597 * <td style="text-align:center; vertical-align:top"> y<sup>4</sup> |
610 * <td style="text-align:center; vertical-align:top"> y<sup>4</sup> |
598 * <td style="text-align:center; vertical-align:top"> y<sup>5</sup> |
611 * <td style="text-align:center; vertical-align:top"> y<sup>5</sup> |
599 * <td style="text-align:center"> - |
612 * <td style="text-align:center"> - |
600 * <td> The result will enclose negative numbers in parentheses |
613 * <td> The result will enclose negative numbers in parentheses |
601 * |
614 * |
|
615 * </tbody> |
602 * </table> |
616 * </table> |
603 * |
617 * |
604 * <p> <sup>1</sup> Depends on the definition of {@link Formattable}. |
618 * <p> <sup>1</sup> Depends on the definition of {@link Formattable}. |
605 * |
619 * |
606 * <p> <sup>2</sup> For {@code 'd'} conversion only. |
620 * <p> <sup>2</sup> For {@code 'd'} conversion only. |
703 * |
717 * |
704 * <h4><a id="dgen">General</a></h4> |
718 * <h4><a id="dgen">General</a></h4> |
705 * |
719 * |
706 * <p> The following general conversions may be applied to any argument type: |
720 * <p> The following general conversions may be applied to any argument type: |
707 * |
721 * |
708 * <table cellpadding=5 summary="dgConv"> |
722 * <table class="striped"> |
|
723 * <caption style="display:none">dgConv</caption> |
|
724 * <tbody> |
709 * |
725 * |
710 * <tr><td style="vertical-align:top"> {@code 'b'} |
726 * <tr><td style="vertical-align:top"> {@code 'b'} |
711 * <td style="vertical-align:top"> <code>'\u0062'</code> |
727 * <td style="vertical-align:top"> <code>'\u0062'</code> |
712 * <td> Produces either "{@code true}" or "{@code false}" as returned by |
728 * <td> Produces either "{@code true}" or "{@code false}" as returned by |
713 * {@link Boolean#toString(boolean)}. |
729 * {@link Boolean#toString(boolean)}. |
754 * |
770 * |
755 * <tr><td style="vertical-align:top"> {@code 'S'} |
771 * <tr><td style="vertical-align:top"> {@code 'S'} |
756 * <td style="vertical-align:top"> <code>'\u0053'</code> |
772 * <td style="vertical-align:top"> <code>'\u0053'</code> |
757 * <td> The upper-case variant of {@code 's'}. |
773 * <td> The upper-case variant of {@code 's'}. |
758 * |
774 * |
|
775 * </tbody> |
759 * </table> |
776 * </table> |
760 * |
777 * |
761 * <p> The following <a id="dFlags">flags</a> apply to general conversions: |
778 * <p> The following <a id="dFlags">flags</a> apply to general conversions: |
762 * |
779 * |
763 * <table cellpadding=5 summary="dFlags"> |
780 * <table class="striped"> |
|
781 * <caption style="display:none">dFlags</caption> |
|
782 * <tbody> |
764 * |
783 * |
765 * <tr><td style="vertical-align:top"> {@code '-'} |
784 * <tr><td style="vertical-align:top"> {@code '-'} |
766 * <td style="vertical-align:top"> <code>'\u002d'</code> |
785 * <td style="vertical-align:top"> <code>'\u002d'</code> |
767 * <td> Left justifies the output. Spaces (<code>'\u0020'</code>) will be |
786 * <td> Left justifies the output. Spaces (<code>'\u0020'</code>) will be |
768 * added at the end of the converted value as required to fill the minimum |
787 * added at the end of the converted value as required to fill the minimum |
773 * <tr><td style="vertical-align:top"> {@code '#'} |
792 * <tr><td style="vertical-align:top"> {@code '#'} |
774 * <td style="vertical-align:top"> <code>'\u0023'</code> |
793 * <td style="vertical-align:top"> <code>'\u0023'</code> |
775 * <td> Requires the output use an alternate form. The definition of the |
794 * <td> Requires the output use an alternate form. The definition of the |
776 * form is specified by the conversion. |
795 * form is specified by the conversion. |
777 * |
796 * |
|
797 * </tbody> |
778 * </table> |
798 * </table> |
779 * |
799 * |
780 * <p> The <a id="genWidth">width</a> is the minimum number of characters to |
800 * <p> The <a id="genWidth">width</a> is the minimum number of characters to |
781 * be written to the |
801 * be written to the |
782 * output. If the length of the converted value is less than the width then |
802 * output. If the length of the converted value is less than the width then |
799 * {@code short}, and {@link Short}, {@code int} and {@link Integer} when |
819 * {@code short}, and {@link Short}, {@code int} and {@link Integer} when |
800 * {@link Character#isValidCodePoint} returns {@code true}. If it returns |
820 * {@link Character#isValidCodePoint} returns {@code true}. If it returns |
801 * {@code false} then an {@link IllegalFormatCodePointException} will be |
821 * {@code false} then an {@link IllegalFormatCodePointException} will be |
802 * thrown. |
822 * thrown. |
803 * |
823 * |
804 * <table cellpadding=5 summary="charConv"> |
824 * <table class="striped"> |
|
825 * <caption style="display:none">charConv</caption> |
|
826 * <tbody> |
805 * |
827 * |
806 * <tr><td style="vertical-align:top"> {@code 'c'} |
828 * <tr><td style="vertical-align:top"> {@code 'c'} |
807 * <td style="vertical-align:top"> <code>'\u0063'</code> |
829 * <td style="vertical-align:top"> <code>'\u0063'</code> |
808 * <td> Formats the argument as a Unicode character as described in <a |
830 * <td> Formats the argument as a Unicode character as described in <a |
809 * href="../lang/Character.html#unicode">Unicode Character |
831 * href="../lang/Character.html#unicode">Unicode Character |
815 * |
837 * |
816 * <tr><td style="vertical-align:top"> {@code 'C'} |
838 * <tr><td style="vertical-align:top"> {@code 'C'} |
817 * <td style="vertical-align:top"> <code>'\u0043'</code> |
839 * <td style="vertical-align:top"> <code>'\u0043'</code> |
818 * <td> The upper-case variant of {@code 'c'}. |
840 * <td> The upper-case variant of {@code 'c'}. |
819 * |
841 * |
|
842 * </tbody> |
820 * </table> |
843 * </table> |
821 * |
844 * |
822 * <p> The {@code '-'} flag defined for <a href="#dFlags">General |
845 * <p> The {@code '-'} flag defined for <a href="#dFlags">General |
823 * conversions</a> applies. If the {@code '#'} flag is given, then a {@link |
846 * conversions</a> applies. If the {@code '#'} flag is given, then a {@link |
824 * FormatFlagsConversionMismatchException} will be thrown. |
847 * FormatFlagsConversionMismatchException} will be thrown. |
900 * |
923 * |
901 * <p> The following conversions may be applied to {@code byte}, {@link Byte}, |
924 * <p> The following conversions may be applied to {@code byte}, {@link Byte}, |
902 * {@code short}, {@link Short}, {@code int} and {@link Integer}, |
925 * {@code short}, {@link Short}, {@code int} and {@link Integer}, |
903 * {@code long}, and {@link Long}. |
926 * {@code long}, and {@link Long}. |
904 * |
927 * |
905 * <table cellpadding=5 summary="IntConv"> |
928 * <table class="striped"> |
|
929 * <caption style="display:none">IntConv</caption> |
|
930 * <tbody> |
906 * |
931 * |
907 * <tr><td style="vertical-align:top"> {@code 'd'} |
932 * <tr><td style="vertical-align:top"> {@code 'd'} |
908 * <td style="vertical-align:top"> <code>'\u0064'</code> |
933 * <td style="vertical-align:top"> <code>'\u0064'</code> |
909 * <td> Formats the argument as a decimal integer. The <a |
934 * <td> Formats the argument as a decimal integer. The <a |
910 * href="#L10nAlgorithm">localization algorithm</a> is applied. |
935 * href="#L10nAlgorithm">localization algorithm</a> is applied. |
966 * representing the number will be converted to {@linkplain |
991 * representing the number will be converted to {@linkplain |
967 * String#toUpperCase upper case} including the {@code 'x'} (if any) and |
992 * String#toUpperCase upper case} including the {@code 'x'} (if any) and |
968 * all hexadecimal digits {@code 'a'} - {@code 'f'} |
993 * all hexadecimal digits {@code 'a'} - {@code 'f'} |
969 * (<code>'\u0061'</code> - <code>'\u0066'</code>). |
994 * (<code>'\u0061'</code> - <code>'\u0066'</code>). |
970 * |
995 * |
|
996 * </tbody> |
971 * </table> |
997 * </table> |
972 * |
998 * |
973 * <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and |
999 * <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and |
974 * both the {@code '#'} and the {@code '0'} flags are given, then result will |
1000 * both the {@code '#'} and the {@code '0'} flags are given, then result will |
975 * contain the radix indicator ({@code '0'} for octal and {@code "0x"} or |
1001 * contain the radix indicator ({@code '0'} for octal and {@code "0x"} or |
980 * before the sign. |
1006 * before the sign. |
981 * |
1007 * |
982 * <p> The following <a id="intFlags">flags</a> apply to numeric integral |
1008 * <p> The following <a id="intFlags">flags</a> apply to numeric integral |
983 * conversions: |
1009 * conversions: |
984 * |
1010 * |
985 * <table cellpadding=5 summary="intFlags"> |
1011 * <table class="striped"> |
|
1012 * <caption style="display:none">intFlags</caption> |
|
1013 * <tbody> |
986 * |
1014 * |
987 * <tr><td style="vertical-align:top"> {@code '+'} |
1015 * <tr><td style="vertical-align:top"> {@code '+'} |
988 * <td style="vertical-align:top"> <code>'\u002b'</code> |
1016 * <td style="vertical-align:top"> <code>'\u002b'</code> |
989 * <td> Requires the output to include a positive sign for all positive |
1017 * <td> Requires the output to include a positive sign for all positive |
990 * numbers. If this flag is not given then only negative values will |
1018 * numbers. If this flag is not given then only negative values will |
1023 * <td style="vertical-align:top"> <code>'\u0028'</code> |
1051 * <td style="vertical-align:top"> <code>'\u0028'</code> |
1024 * <td> Requires the output to prepend a {@code '('} |
1052 * <td> Requires the output to prepend a {@code '('} |
1025 * (<code>'\u0028'</code>) and append a {@code ')'} |
1053 * (<code>'\u0028'</code>) and append a {@code ')'} |
1026 * (<code>'\u0029'</code>) to negative values. |
1054 * (<code>'\u0029'</code>) to negative values. |
1027 * |
1055 * |
|
1056 * </tbody> |
1028 * </table> |
1057 * </table> |
1029 * |
1058 * |
1030 * <p> If no <a id="intdFlags">flags</a> are given the default formatting is |
1059 * <p> If no <a id="intdFlags">flags</a> are given the default formatting is |
1031 * as follows: |
1060 * as follows: |
1032 * |
1061 * |
1058 * <p><a id="dnbint"><b> BigInteger </b></a> |
1087 * <p><a id="dnbint"><b> BigInteger </b></a> |
1059 * |
1088 * |
1060 * <p> The following conversions may be applied to {@link |
1089 * <p> The following conversions may be applied to {@link |
1061 * java.math.BigInteger}. |
1090 * java.math.BigInteger}. |
1062 * |
1091 * |
1063 * <table cellpadding=5 summary="BIntConv"> |
1092 * <table class="striped"> |
|
1093 * <caption style="display:none">bIntConv</caption> |
|
1094 * <tbody> |
1064 * |
1095 * |
1065 * <tr><td style="vertical-align:top"> {@code 'd'} |
1096 * <tr><td style="vertical-align:top"> {@code 'd'} |
1066 * <td style="vertical-align:top"> <code>'\u0064'</code> |
1097 * <td style="vertical-align:top"> <code>'\u0064'</code> |
1067 * <td> Requires the output to be formatted as a decimal integer. The <a |
1098 * <td> Requires the output to be formatted as a decimal integer. The <a |
1068 * href="#L10nAlgorithm">localization algorithm</a> is applied. |
1099 * href="#L10nAlgorithm">localization algorithm</a> is applied. |
1123 * representing the number will be converted to {@linkplain |
1154 * representing the number will be converted to {@linkplain |
1124 * String#toUpperCase upper case} including the {@code 'x'} (if any) and |
1155 * String#toUpperCase upper case} including the {@code 'x'} (if any) and |
1125 * all hexadecimal digits {@code 'a'} - {@code 'f'} |
1156 * all hexadecimal digits {@code 'a'} - {@code 'f'} |
1126 * (<code>'\u0061'</code> - <code>'\u0066'</code>). |
1157 * (<code>'\u0061'</code> - <code>'\u0066'</code>). |
1127 * |
1158 * |
|
1159 * </tbody> |
1128 * </table> |
1160 * </table> |
1129 * |
1161 * |
1130 * <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and |
1162 * <p> If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and |
1131 * both the {@code '#'} and the {@code '0'} flags are given, then result will |
1163 * both the {@code '#'} and the {@code '0'} flags are given, then result will |
1132 * contain the base indicator ({@code '0'} for octal and {@code "0x"} or |
1164 * contain the base indicator ({@code '0'} for octal and {@code "0x"} or |
1152 * <p><a id="dndec"><b> Float and Double</b></a> |
1184 * <p><a id="dndec"><b> Float and Double</b></a> |
1153 * |
1185 * |
1154 * <p> The following conversions may be applied to {@code float}, {@link |
1186 * <p> The following conversions may be applied to {@code float}, {@link |
1155 * Float}, {@code double} and {@link Double}. |
1187 * Float}, {@code double} and {@link Double}. |
1156 * |
1188 * |
1157 * <table cellpadding=5 summary="floatConv"> |
1189 * <table class="striped"> |
|
1190 * <caption style="display:none">floatConv</caption> |
|
1191 * <tbody> |
1158 * |
1192 * |
1159 * <tr><td style="vertical-align:top"> {@code 'e'} |
1193 * <tr><td style="vertical-align:top"> {@code 'e'} |
1160 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1194 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1161 * <td> Requires the output to be formatted using <a |
1195 * <td> Requires the output to be formatted using <a |
1162 * id="scientific">computerized scientific notation</a>. The <a |
1196 * id="scientific">computerized scientific notation</a>. The <a |
1329 * representing the number will be converted to upper case including the |
1363 * representing the number will be converted to upper case including the |
1330 * {@code 'x'} (<code>'\u0078'</code>) and {@code 'p'} |
1364 * {@code 'x'} (<code>'\u0078'</code>) and {@code 'p'} |
1331 * (<code>'\u0070'</code> and all hexadecimal digits {@code 'a'} - |
1365 * (<code>'\u0070'</code> and all hexadecimal digits {@code 'a'} - |
1332 * {@code 'f'} (<code>'\u0061'</code> - <code>'\u0066'</code>). |
1366 * {@code 'f'} (<code>'\u0061'</code> - <code>'\u0066'</code>). |
1333 * |
1367 * |
|
1368 * </tbody> |
1334 * </table> |
1369 * </table> |
1335 * |
1370 * |
1336 * <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and |
1371 * <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and |
1337 * Long apply. |
1372 * Long apply. |
1338 * |
1373 * |
1386 * <p><a id="dnbdec"><b> BigDecimal </b></a> |
1421 * <p><a id="dnbdec"><b> BigDecimal </b></a> |
1387 * |
1422 * |
1388 * <p> The following conversions may be applied {@link java.math.BigDecimal |
1423 * <p> The following conversions may be applied {@link java.math.BigDecimal |
1389 * BigDecimal}. |
1424 * BigDecimal}. |
1390 * |
1425 * |
1391 * <table cellpadding=5 summary="floatConv"> |
1426 * <table class="striped"> |
|
1427 * <caption style="display:none">floatConv</caption> |
|
1428 * <tbody> |
1392 * |
1429 * |
1393 * <tr><td style="vertical-align:top"> {@code 'e'} |
1430 * <tr><td style="vertical-align:top"> {@code 'e'} |
1394 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1431 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1395 * <td> Requires the output to be formatted using <a |
1432 * <td> Requires the output to be formatted using <a |
1396 * id="bscientific">computerized scientific notation</a>. The <a |
1433 * id="bscientific">computerized scientific notation</a>. The <a |
1490 * {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up |
1527 * {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up |
1491 * algorithm}. Otherwise, zeros may be appended to reach the precision. |
1528 * algorithm}. Otherwise, zeros may be appended to reach the precision. |
1492 * For a canonical representation of the value, use {@link |
1529 * For a canonical representation of the value, use {@link |
1493 * BigDecimal#toString()}. |
1530 * BigDecimal#toString()}. |
1494 * |
1531 * |
|
1532 * </tbody> |
1495 * </table> |
1533 * </table> |
1496 * |
1534 * |
1497 * <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and |
1535 * <p> All <a href="#intFlags">flags</a> defined for Byte, Short, Integer, and |
1498 * Long apply. |
1536 * Long apply. |
1499 * |
1537 * |
1510 * <h4><a id="ddt">Date/Time</a></h4> |
1548 * <h4><a id="ddt">Date/Time</a></h4> |
1511 * |
1549 * |
1512 * <p> This conversion may be applied to {@code long}, {@link Long}, {@link |
1550 * <p> This conversion may be applied to {@code long}, {@link Long}, {@link |
1513 * Calendar}, {@link Date} and {@link TemporalAccessor TemporalAccessor} |
1551 * Calendar}, {@link Date} and {@link TemporalAccessor TemporalAccessor} |
1514 * |
1552 * |
1515 * <table cellpadding=5 summary="DTConv"> |
1553 * <table class="striped"> |
|
1554 * <caption style="display:none">DTConv</caption> |
|
1555 * <tbody> |
1516 * |
1556 * |
1517 * <tr><td style="vertical-align:top"> {@code 't'} |
1557 * <tr><td style="vertical-align:top"> {@code 't'} |
1518 * <td style="vertical-align:top"> <code>'\u0074'</code> |
1558 * <td style="vertical-align:top"> <code>'\u0074'</code> |
1519 * <td> Prefix for date and time conversion characters. |
1559 * <td> Prefix for date and time conversion characters. |
1520 * <tr><td style="vertical-align:top"> {@code 'T'} |
1560 * <tr><td style="vertical-align:top"> {@code 'T'} |
1521 * <td style="vertical-align:top"> <code>'\u0054'</code> |
1561 * <td style="vertical-align:top"> <code>'\u0054'</code> |
1522 * <td> The upper-case variant of {@code 't'}. |
1562 * <td> The upper-case variant of {@code 't'}. |
1523 * |
1563 * |
|
1564 * </tbody> |
1524 * </table> |
1565 * </table> |
1525 * |
1566 * |
1526 * <p> The following date and time conversion character suffixes are defined |
1567 * <p> The following date and time conversion character suffixes are defined |
1527 * for the {@code 't'} and {@code 'T'} conversions. The types are similar to |
1568 * for the {@code 't'} and {@code 'T'} conversions. The types are similar to |
1528 * but not completely identical to those defined by GNU {@code date} and |
1569 * but not completely identical to those defined by GNU {@code date} and |
1530 * access Java-specific functionality (e.g. {@code 'L'} for milliseconds |
1571 * access Java-specific functionality (e.g. {@code 'L'} for milliseconds |
1531 * within the second). |
1572 * within the second). |
1532 * |
1573 * |
1533 * <p> The following conversion characters are used for formatting times: |
1574 * <p> The following conversion characters are used for formatting times: |
1534 * |
1575 * |
1535 * <table cellpadding=5 summary="time"> |
1576 * <table class="striped"> |
|
1577 * <caption style="display:none">time</caption> |
|
1578 * <tbody> |
1536 * |
1579 * |
1537 * <tr><td style="vertical-align:top"> {@code 'H'} |
1580 * <tr><td style="vertical-align:top"> {@code 'H'} |
1538 * <td style="vertical-align:top"> <code>'\u0048'</code> |
1581 * <td style="vertical-align:top"> <code>'\u0048'</code> |
1539 * <td> Hour of the day for the 24-hour clock, formatted as two digits with |
1582 * <td> Hour of the day for the 24-hour clock, formatted as two digits with |
1540 * a leading zero as necessary i.e. {@code 00 - 23}. {@code 00} |
1583 * a leading zero as necessary i.e. {@code 00 - 23}. {@code 00} |
1618 * <td> Milliseconds since the beginning of the epoch starting at 1 January |
1661 * <td> Milliseconds since the beginning of the epoch starting at 1 January |
1619 * 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to |
1662 * 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to |
1620 * {@code Long.MAX_VALUE}. The precision of this value is limited by |
1663 * {@code Long.MAX_VALUE}. The precision of this value is limited by |
1621 * the resolution of the underlying operating system or hardware. |
1664 * the resolution of the underlying operating system or hardware. |
1622 * |
1665 * |
|
1666 * </tbody> |
1623 * </table> |
1667 * </table> |
1624 * |
1668 * |
1625 * <p> The following conversion characters are used for formatting dates: |
1669 * <p> The following conversion characters are used for formatting dates: |
1626 * |
1670 * |
1627 * <table cellpadding=5 summary="date"> |
1671 * <table class="striped"> |
|
1672 * <caption style="display:none">date</caption> |
|
1673 * <tbody> |
1628 * |
1674 * |
1629 * <tr><td style="vertical-align:top">{@code 'B'} |
1675 * <tr><td style="vertical-align:top">{@code 'B'} |
1630 * <td style="vertical-align:top"> <code>'\u0042'</code> |
1676 * <td style="vertical-align:top"> <code>'\u0042'</code> |
1631 * <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths |
1677 * <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths |
1632 * full month name}, e.g. {@code "January"}, {@code "February"}. |
1678 * full month name}, e.g. {@code "January"}, {@code "February"}. |
1690 * <tr><td style="vertical-align:top">{@code 'e'} |
1736 * <tr><td style="vertical-align:top">{@code 'e'} |
1691 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1737 * <td style="vertical-align:top"> <code>'\u0065'</code> |
1692 * <td> Day of month, formatted as two digits, i.e. {@code 1 - 31} where |
1738 * <td> Day of month, formatted as two digits, i.e. {@code 1 - 31} where |
1693 * "{@code 1}" is the first day of the month. |
1739 * "{@code 1}" is the first day of the month. |
1694 * |
1740 * |
|
1741 * </tbody> |
1695 * </table> |
1742 * </table> |
1696 * |
1743 * |
1697 * <p> The following conversion characters are used for formatting common |
1744 * <p> The following conversion characters are used for formatting common |
1698 * date/time compositions. |
1745 * date/time compositions. |
1699 * |
1746 * |
1700 * <table cellpadding=5 summary="composites"> |
1747 * <table class="striped"> |
|
1748 * <caption style="display:none">composites</caption> |
|
1749 * <tbody> |
1701 * |
1750 * |
1702 * <tr><td style="vertical-align:top">{@code 'R'} |
1751 * <tr><td style="vertical-align:top">{@code 'R'} |
1703 * <td style="vertical-align:top"> <code>'\u0052'</code> |
1752 * <td style="vertical-align:top"> <code>'\u0052'</code> |
1704 * <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"} |
1753 * <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"} |
1705 * |
1754 * |
1725 * <tr><td style="vertical-align:top">{@code 'c'} |
1774 * <tr><td style="vertical-align:top">{@code 'c'} |
1726 * <td style="vertical-align:top"> <code>'\u0063'</code> |
1775 * <td style="vertical-align:top"> <code>'\u0063'</code> |
1727 * <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, |
1776 * <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, |
1728 * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. |
1777 * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. |
1729 * |
1778 * |
|
1779 * </tbody> |
1730 * </table> |
1780 * </table> |
1731 * |
1781 * |
1732 * <p> The {@code '-'} flag defined for <a href="#dFlags">General |
1782 * <p> The {@code '-'} flag defined for <a href="#dFlags">General |
1733 * conversions</a> applies. If the {@code '#'} flag is given, then a {@link |
1783 * conversions</a> applies. If the {@code '#'} flag is given, then a {@link |
1734 * FormatFlagsConversionMismatchException} will be thrown. |
1784 * FormatFlagsConversionMismatchException} will be thrown. |
1746 * |
1796 * |
1747 * <h4><a id="dper">Percent</a></h4> |
1797 * <h4><a id="dper">Percent</a></h4> |
1748 * |
1798 * |
1749 * <p> The conversion does not correspond to any argument. |
1799 * <p> The conversion does not correspond to any argument. |
1750 * |
1800 * |
1751 * <table cellpadding=5 summary="DTConv"> |
1801 * <table class="striped"> |
|
1802 * <caption style="display:none">DTConv</caption> |
|
1803 * <tbody> |
1752 * |
1804 * |
1753 * <tr><td style="vertical-align:top">{@code '%'} |
1805 * <tr><td style="vertical-align:top">{@code '%'} |
1754 * <td> The result is a literal {@code '%'} (<code>'\u0025'</code>) |
1806 * <td> The result is a literal {@code '%'} (<code>'\u0025'</code>) |
1755 * |
1807 * |
1756 * <p> The width is the minimum number of characters to |
1808 * <p> The width is the minimum number of characters to |
1765 * {@link FormatFlagsConversionMismatchException} will be thrown. |
1817 * {@link FormatFlagsConversionMismatchException} will be thrown. |
1766 * |
1818 * |
1767 * <p> The precision is not applicable. If the precision is specified an |
1819 * <p> The precision is not applicable. If the precision is specified an |
1768 * {@link IllegalFormatPrecisionException} will be thrown. |
1820 * {@link IllegalFormatPrecisionException} will be thrown. |
1769 * |
1821 * |
|
1822 * </tbody> |
1770 * </table> |
1823 * </table> |
1771 * |
1824 * |
1772 * <h4><a id="dls">Line Separator</a></h4> |
1825 * <h4><a id="dls">Line Separator</a></h4> |
1773 * |
1826 * |
1774 * <p> The conversion does not correspond to any argument. |
1827 * <p> The conversion does not correspond to any argument. |
1775 * |
1828 * |
1776 * <table cellpadding=5 summary="DTConv"> |
1829 * <table class="striped"> |
|
1830 * <caption style="display:none">DTConv</caption> |
|
1831 * <tbody> |
1777 * |
1832 * |
1778 * <tr><td style="vertical-align:top">{@code 'n'} |
1833 * <tr><td style="vertical-align:top">{@code 'n'} |
1779 * <td> the platform-specific line separator as returned by {@link |
1834 * <td> the platform-specific line separator as returned by {@link |
1780 * System#lineSeparator()}. |
1835 * System#lineSeparator()}. |
1781 * |
1836 * |
|
1837 * </tbody> |
1782 * </table> |
1838 * </table> |
1783 * |
1839 * |
1784 * <p> Flags, width, and precision are not applicable. If any are provided an |
1840 * <p> Flags, width, and precision are not applicable. If any are provided an |
1785 * {@link IllegalFormatFlagsException}, {@link IllegalFormatWidthException}, |
1841 * {@link IllegalFormatFlagsException}, {@link IllegalFormatWidthException}, |
1786 * and {@link IllegalFormatPrecisionException}, respectively will be thrown. |
1842 * and {@link IllegalFormatPrecisionException}, respectively will be thrown. |