ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਫਰਮਾ:Nts/doc

ਵਿਕੀਪੀਡੀਆ, ਇੱਕ ਆਜ਼ਾਦ ਵਿਸ਼ਵਕੋਸ਼ ਤੋਂ

Nts/doc stands for Number Table Sorting and is used to display numbers with thousands separator in a sortable table and have them numerically sorted in alphabetic sort mode. It is applied to all numbers of a column, in cases where numeric sort mode does not work or is not desired.

Purpose

[ਸੋਧੋ]

If some table cells in a column contain text after the number, or if the numbers are preceded by some fixed text other than a currency symbol, alphabetic sorting mode is needed.

Also, formerly, for table sorting to function correctly, numbers had to be entered with not more than one thousands separator. As a workaround alphabetic sorting mode was applied, and the numbers provided with a hidden part so that alphabetic sorting corresponded with numeric sorting. Since a mix in one column of numbers formatted for alphabetic sorting and plain numbers does not allow proper sorting, adding a number in an existing table may require putting it in the format used in that column.

Method

[ਸੋਧੋ]

This template automatically creates hidden code like <span style="display:none">&0000000123456789.001230</span> before the actual displayed number. The preceding ampersand forces the sorting routine to use text sort. The routine sorts the total text without the tags, which corresponds to numeric sorting due to the leading zeros.

Limitations

[ਸੋਧੋ]
  • Negative numbers do not sort correctly with this template.
  • The maximum is 16 digits before, and 6 digits after the decimal separator.
  • In the case of variable text before the numbers, the sorting is primarily based on those texts, the numbers are the secondary sort keys.

Parameters

[ਸੋਧੋ]

The template has only one parameter: a real number without thousand separators.

Example

[ਸੋਧੋ]
{{Nts|123456789.00123}}

expands to

 <span style="display:none">&0000000123456789.001230</span> 123,456,789.00123 

which is rendered as &0000000123456789.00123012,34,56,789.00123

Debug option

[ਸੋਧੋ]

"{{nts|123456789.00123|debug=yes}}" gives "&0000000123456789.00123012,34,56,789.00123" "`UNIQ--gallery-00000016-QINU`"'__%22_'"`UNIQ--gallery-00000017-QINU`"'__%7B_'"`UNIQ--gallery-00000018-QINU`"'__%7B_'"`UNIQ--gallery-00000019-QINU`"'__nts_'"`UNIQ--gallery-0000001A-QINU`"'__%7c_'"`UNIQ--gallery-0000001B-QINU`"'___'"`UNIQ--gallery-0000001C-QINU`"'__123456789.00123_'"`UNIQ--gallery-0000001D-QINU`"'___'"`UNIQ--gallery-0000001E-QINU`"'__%7c_'"`UNIQ--gallery-0000001F-QINU`"'__debug_'"`UNIQ--gallery-00000020-QINU`"'__%3d_'"`UNIQ--gallery-00000021-QINU`"'__yes_'"`UNIQ--gallery-00000022-QINU`"'__%7D_'"`UNIQ--gallery-00000023-QINU`"'__%7D_'"`UNIQ--gallery-00000024-QINU`"'___'"`UNIQ--gallery-00000025-QINU`"'___'"`UNIQ--gallery-00000026-QINU`"'___'"`UNIQ--gallery-00000027-QINU`"'___'"`UNIQ--gallery-00000028-QINU`"'___'"`UNIQ--gallery-00000029-QINU`"'___'"`UNIQ--gallery-0000002A-QINU`"'___'"`UNIQ--gallery-0000002B-QINU`"'___'"`UNIQ--gallery-0000002C-QINU`"'___'"`UNIQ--gallery-0000002D-QINU`"'__%22&removecomments=true

See also

[ਸੋਧੋ]