Template:Money
Revision as of 14:31, 25 August 2022 by Kevin Wang (talk | contribs) (Created page with "{{#vardefine:money|{{{1|0}}}}}{{#if:{{#vardefineecho:cents|{{#explode:{{#var:money}}|.|1}}}}|{{#explode:{{#var:money}}|.|0}}.{{#sub:{{#var:cents}}{{#loop:i|0|{{#expr:2-{{#len:...")
0
For formatting dollar amounts in standard $XXXX.YY format.
- Does not add commas
- Will not add decimals if the number is whole
- Truncates rather than rounds
| Input | Output |
|---|---|
{{Money|1200}}
|
1200 |
{{Money|12.30}}
|
12.30 |
{{Money|11.3}}
|
11.30 |
{{Money|187.921}}
|
187.92 |
{{Money|9.}}
|
9. |