Template:Nts

维基百科,自由的百科全书
跳转至: 导航搜索
Documentation icon 模板文档[查看] [编辑] [历史] [刷新]

Similar to Dts, Nts stands for Number Table Sorting and 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

See also[编辑]

  • Template:Ntsh- same as Nts, but does not display the number
  • Template:Lsc11- using non-breaking spaces instead of ampersands in a similar fashion