Template:Commas
Commas is used to correctly sort and display numbers using thousands separators in a table when using sortable tables.
What it solves
To use Help:Sorting and have it function correctly, numbers must be entered without thousands separators. To enable the display of thousands separators, this template automatically creates the hidden <span style="display:none">&&&&&&&123456789.&&1230</span> 123,456,789.00123
before the actual displayed number. It forces the sorting routine to use text sort on the hidden segment, which functions correctly due to the preceding ampersands (currently till 16 digits before, and 6 digits after the decimal separator).
Parameters
Only one: a real number without thousand separators.
Input
{{Nts|123456789.00123}}
Output
Output sent to table
<span style="display:none">&&&&&&&123456789.&&1230</span> 123,456,789.00123
Output displayed to user
123,456,789.00123
The above documentation is transcluded from Template:Commas/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |