Difference between revisions of "Template:Val/delimitnum"

From blackwiki
Jump to navigation Jump to search
blackwiki>Jason Quinn
(two spell fixes)
blackwiki>Cpiral
(swap in the 4-digit-integer handling logic)
Line 5: Line 5:
 
   -->{{#ifexpr:{{{1|0}}}<0|&minus;}}<!-- Output the mathematical minus sign (not the minus-hyphen) if negative
 
   -->{{#ifexpr:{{{1|0}}}<0|&minus;}}<!-- Output the mathematical minus sign (not the minus-hyphen) if negative
 
   -->{{#ifexpr:abs({{{1|0}}}1)>10*abs({{{1|0}}})|<!-- Number is an integer (no dot): appending a non-zero digit multiplies it by more than 10
 
   -->{{#ifexpr:abs({{{1|0}}}1)>10*abs({{{1|0}}})|<!-- Number is an integer (no dot): appending a non-zero digit multiplies it by more than 10
     -->{{formatnum:{{#expr:abs({{{1|0}}})}}}}<!-- Format the integer using locale's separator for grouping digits
+
  -->{{#ifexpr:{{{1|0}}}>9999|<!-- If the integer is more than four digits
 +
     -->{{formatnum:{{#expr:abs({{{1|0}}})}}}}|{{{1|0}}}}}<!-- Group digits using locale separator; else output the four digit number
 
   -->|<!-- Number is not an integer (at least contains a dot)
 
   -->|<!-- Number is not an integer (at least contains a dot)
 
     -->{{formatnum:{{#expr:trunc(abs({{{1|0}}}))}}.}}<!-- Format the integer part using locale's separator for grouping digits, followed by the locale's separator before fractional decimals
 
     -->{{formatnum:{{#expr:trunc(abs({{{1|0}}}))}}.}}<!-- Format the integer part using locale's separator for grouping digits, followed by the locale's separator before fractional decimals

Revision as of 00:26, 13 December 2012

Template documentation[create]