Template:Number table sorting
Similar to Dts, Number table sorting 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).
參數
此模板僅一個參數:不含逗點的實數。
輸入
{{Nts|123456789.00123}}
輸出
產生的代碼:
<span style="display:none">&&&&&&&123456789.&&1230</span> 123,456,789.00123
使用者看到的輸出:
123,456,789.00123
參見
- Template:Ntsh,與Nts同,但使用者不會看到所產生的數字。
- Template:Lsc11- using non-breaking spaces instead of ampersands in a similar fashion
上述文档嵌入自Template:Number table sorting/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。 本模板的子页面。 |