Difference between revisions of "Template:Format size"

From Wikispooks
Jump to navigation Jump to search
(decimals only up to 9.9k)
(decimals only up to 9.9k and  K)
 
Line 2: Line 2:
 
Usage:<br/> {{t|<nowiki>{{</nowiki>{{PAGENAME}}|#bytes<nowiki>}}</nowiki>}}</noinclude><includeonly>{{#if: {{{1|}}}|{{#ifexpr:
 
Usage:<br/> {{t|<nowiki>{{</nowiki>{{PAGENAME}}|#bytes<nowiki>}}</nowiki>}}</noinclude><includeonly>{{#if: {{{1|}}}|{{#ifexpr:
 
{{#replace:{{{1}}}|,|}} < 1024| {{{1}}} bytes|{{#ifexpr:
 
{{#replace:{{{1}}}|,|}} < 1024| {{{1}}} bytes|{{#ifexpr:
{{#replace:{{{1}}}|,|}} < 10240| {{#expr: {{#replace:{{{1}}}|,|}}/1024 round 1}} K|
+
{{#replace:{{{1}}}|,|}} < 10240| {{#expr: {{#replace:{{{1}}}|,|}}/1024 round 1}}&nbsp;K|
{{#expr: {{#replace:{{{1}}}|,|}}/1024 round 0}} K}}}}|}}</includeonly>
+
{{#expr: {{#replace:{{{1}}}|,|}}/1024 round 0}}&nbsp;K}}}}|}}</includeonly>

Latest revision as of 06:28, 26 October 2016

This is for displaying a number of bytes in an easily understood format.

Usage:
{{Format size|#bytes}}