模板:Format price
外观
(重定向自Template:Formatprice)
This template displays numbers typically representing prices in a pleasant way, ideally suited for articles. Numbers one thousand or greater are reduced down and rounded to a total of three digits followed by a multiplier text, and smaller numbers received separators and exactly two digits to represent cents, which does not always happen with the {{formatnum:}} magic word.
用法
{{Format price|value|digits}}
Where:
- value: the value that will be formatted and displayed (required).
- digits: sets the digit in which a value lower than one thousand must be rounded, defaulting to "2" (cents) if unspecified.
Providing non-numeric parameters, failing to provide any parameter, or providing a negative value parameter, result all in a link to the NaN article. Despite its name, this template only handles the number-formatting, not any unit symbols – consider {{currency}} for that separate feature.
范例
{{Format price|1.2}}
= 1.20{{Format price|456.789}}
= 456.79{{Format price|456.789|1}}
= 456.80{{Format price|456.789|0}}
= 457{{Format price|456.789|-2}}
= 500$
{{Format price|1234}}
= $1.23千$
{{Format price|12345}}
= $1.23万$
{{Format price|123456}}
= $12.3万$
{{Format price|1000000}}
= $100万¥
{{Format price|98765432109876}}
= ¥98.8万亿{{Format price|7.86178E+25}}
atoms = 78.6秭 atoms{{Format price}}
= NaN{{Format price||0}}
= NaN{{Format price|-100}}
= NaN{{Format price|xyz|A}}
= NaN
参见
- {{Inflation}}
- {{Inflation-fn}}
上述文档嵌入自Template:Format price/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |