Difference between revisions of "Template:Dp"
From Organic Design wiki
m |
(#pad now padright) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <noinclude>{{ | + | <noinclude>{{info|This template sets a value to a specified number of decimal places, usage: |
− | This template sets a value to a specified number of decimal places, usage: | ||
:<tt><nowiki>{{dp|2|1.234}}</nowiki></tt> | :<tt><nowiki>{{dp|2|1.234}}</nowiki></tt> | ||
Where the first parameter is the number of decimal places, and the second is the value to format. | Where the first parameter is the number of decimal places, and the second is the value to format. | ||
− | }}</noinclude> | + | }} |
− | {{#vardefine:tmp|{{#expr:{{{2}}}+0.0{{ | + | [[Category: Templates using Template:Message]][[Category:Formatting templates]] |
+ | </noinclude><includeonly>{{#vardefine:tmp|{{#expr:{{{2}}}+0.0{{padright:{{{1}}}|5|0}}}}}}{{#sub:{{#var:tmp}}|0|{{#expr:{{#pos:{{#var:tmp}}|.}}+{{{1}}}+1}}}}</includeonly> |