Extension:FormatNum/zh

Extension FormatNum makes it easier to format numbers in the style you want, independent of language settings. For input "english" format is used with point as decimal separator.

用法



 * otsep: thousands separator in the number given, that will be removed. For example when having a number like 123.456.789,123 and setting otsep=. will remove all points from the number before converting.
 * mint: the minimal number given to separate thousands. For example when setting to 4 the number 1234 will remain as is and 12345 will be separated to 12 345.

示例

 * -{zh-hans:结果;zh-hant:結果}-： 2 300,12
 * -{zh-hans:结果;zh-hant:結果}-： 2 300,12


 * -{zh-hans:结果;zh-hant:結果}-： 2,300.12
 * -{zh-hans:结果;zh-hant:結果}-： 2,300.12


 * -{zh-hans:结果;zh-hant:結果}-： 2,300.12
 * -{zh-hans:结果;zh-hant:結果}-： 2,300.12


 * -{zh-hans:结果;zh-hant:結果}-： 2&thinsp;300,12
 * -{zh-hans:结果;zh-hant:結果}-： 2&thinsp;300,12

As thousand separator the following parameters can be also used
 * n – will be &nbsp&#59;
 * t – will be &thinsp&#59;

安装
Download the files from GitHub. Put them in /extensions/FormatNum and add the following to your

使用示例
On Wikipedia formatting of numbers is done with complex templates like this. With the #formatnum parser this would be a lot easier.

参见

 * 扩展:NumberFormat
 * 40422-审核和部署请求

链接

 * number_format在php.net的描述