Templat:Formatprice
Templat ini menggunakan ciri-ciri sintaks templat yang rumit.
Anda digalakkan untuk membiasakan diri dengan persediaan dan fungsi penghurai sebelum menyunting templat ini. Jika suntingan anda menyebabkan masalah yang tidak diduga, sila undurkannya dengan segera kerana templat ini mungkin digunakan di sebilangan besar halaman. Ingat bahawa anda boleh menjalankan uji kaji dan perlu menguji semua penambahbaikan, sama ada di kotak pasir umum atau laman pengguna anda sebelum melakukan sebarang perubahan. (lihat sejarah) |
This template display 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, what doesn't always happen with the {{formatnum:}} magic word.
Usage sunting
{{Formatprice|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.
Examples sunting
-
{{Formatprice|1.2}}
= 1.20 -
{{Formatprice|456.789}}
= 456.79 -
{{Formatprice|456.789|1}}
= 456.80 -
{{Formatprice|456.789|0}}
= 457 -
{{Formatprice|456.789|-2}}
= 500 - $
{{Formatprice|1234}}
= $1.23 ribu - $
{{Formatprice|12345}}
= $12.3 ribu - $
{{Formatprice|123456}}
= $123 ribu - $
{{Formatprice|1000000}}
= $1 juta - ¥
{{Formatprice|98765432109876}}
= ¥98.8 trilion -
{{Formatprice|7.86178E+25}}
atoms = 78.6 septillion atoms -
{{Formatprice}}
= NaN -
{{Formatprice||0}}
= NaN -
{{Formatprice|-100}}
= NaN -
{{Formatprice|xyz|A}}
= NaN
See also sunting
- {{Inflation}}
- {{Inflation-fn}}
Pendokumenan di atas ditransklusikan daripada Templat:Formatprice/doc. (sunting | sejarah) Para penyunting boleh membuat percubaan di laman kotak pasir (cipta | cermin) dan kes ujian (cipta) templat ini. Sila letakkan kategori di sublaman /doc. Sublaman templat ini. |