Symbol Meaning
0 a digit
# a digit, zero shows as absent
. placeholder for decimal separator
, placeholder for grouping separator.
E separates mantissa and exponent for exponential formats.
- default negative prefix.
% multiply by 100 and show as percentage
X any other characters can be used in the prefix or suffix
' used to quote special characters in a prefix or suffix.
A DecodedNumber
pattern contains a positive and negative subpattern, for example, "#,##0.00;(#,##0.00)"
. Each subpattern has a prefix, numeric part, and suffix. The negative subpattern is optional; if absent, then the positive subpattern prefixed with the localized minus sign (code>'-' in most locales) is used as the negative subpattern. That is, "0.00"
alone is equivalent to "0.00;-0.00"
. If there is an explicit negative subpattern, it serves only to specify the negative prefix and suffix; the number of digits, minimal digits, and other characteristics are all the same as the positive pattern. That means that "#,##0.0#;(#)"
produces precisely the same behavior as "#,##0.0#;(#,##0.0#)"
.
Symbol | Location | Localized? | Meaning |
0 | Number | Yes | Digit |
# | Number | Yes | Digit, zero shows as absent |
. | Number | Yes | Decimal separator or monetary decimal separator |
- | Number | Yes | Minus sign |
, | Number | Yes | Grouping separator |
E | Number | Yes | Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix. |
; | Subpattern boundary | Yes | Separates positive and negative subpatterns |
% | Prefix or suffix | Yes | Multiply by 100 and show as percentage |
\u2030 | Prefix or suffix | Yes | Multiply by 1000 and show as per mille |
¤ (\u00A4 ) | Prefix or suffix | No | Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator. |
' | Prefix or suffix | No | Used to quote special characters in a prefix or suffix, for example, "'#'#" formats 123 to "#123" . To create a single quote itself, use two in a row: "# o''clock" . |
@param < T>