Difference between revisions of "Template:Dp"

From Organic Design wiki
(Imported from work.organicdesign.co.nz by sync-wikiorg.pl)
(#pad now padright)
 
Line 4: Line 4:
 
}}
 
}}
 
[[Category: Templates using Template:Message]][[Category:Formatting templates]]
 
[[Category: Templates using Template:Message]][[Category:Formatting templates]]
</noinclude><includeonly>{{#vardefine:tmp|{{#expr:{{{2}}}+0.0{{#pad:5|{{{1}}}|0}}}}}}{{#sub:{{#var:tmp}}|0|{{#expr:{{#pos:{{#var:tmp}}|.}}+{{{1}}}+1}}}}</includeonly>
+
</noinclude><includeonly>{{#vardefine:tmp|{{#expr:{{{2}}}+0.0{{padright:{{{1}}}|5|0}}}}}}{{#sub:{{#var:tmp}}|0|{{#expr:{{#pos:{{#var:tmp}}|.}}+{{{1}}}+1}}}}</includeonly>

Latest revision as of 23:11, 29 September 2012

Info.svg This template sets a value to a specified number of decimal places, usage:
{{dp|2|1.234}}

Where the first parameter is the number of decimal places, and the second is the value to format.