Main functions and usage of Java decimalformat

Decimalformat is a concrete subclass of numberformat used to format decimal numbers. This kind of design has various functions to enable it to analyze and format numbers in any language environment, including support for western, Arabic and Hindi numbers. It also supports different types of numbers, including integer (123), fixed-point number (123.4), scientific notation number (1.23e4), percentage (12%) and amount ($123). All of this content can be localized. Decimalformat contains a pattern and a set of symbols

Symbol location localization? Meaning 0 numbers are Arabic numerals

. Numbers are decimal separators or currency decimal separators, numbers are minus signs, numbers are grouping separators, e numbers are mantissas and exponents in scientific counting. No quotation marks are required in the prefix or suffix; The sub mode boundary separates positive and negative numbers. The sub mode% prefix or suffix is multiplied by 100 and displayed as a percentage / u2030. The prefix or suffix is multiplied by 1000 and displayed as a thousand fraction Δ (/ u00a4) prefix or suffix. No currency sign is replaced by currency symbol. If two occur at the same time, replace with the international currency symbol. If it appears in a pattern, the currency decimal separator is used instead of the decimal separator. " Prefix or suffix no is used to quote special characters in a prefix or suffix, such as' # '#' formatting 123 as' #123 '. To create the single quotation mark itself, use two consecutive single quotation marks: "# o ''clock".

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>