फलकम्:Nts/doc
This is a documentation subpage for फलकम्:Terminate sentence It may contain usage information, categories and other content that is not part of the original फलकम् page. |
This template can be useful when building a sortable table in which a column contains both numbers and text. This template should be applied to every number in the column.
Currently, the template works for numbers less than or 10,000,000,000,000,000 (1×1016) and greater than -10,000,000,000,000,000 (-1×1016). Numbers outside this range will sort above or below other numbers depending on sign. See the Limitations section below.
By default the output is displayed using thousands separators. To display numbers as entered, use |format=no
.
The template generates a hidden "sort key" in the HTML markup which forces the Javascript sorting algorithm to sort the column alphabetically.
Purpose
सम्पादयतुThere are at two cases where this template is useful:
- When numbers are followed by some text
- When numbers are preceded by some text other than a currency symbol.
Parameters
सम्पादयतुThe template has only one required parameter: a real number. These examples use the name of the redirect, {{nts}}, for brevity.
- Optional parameters
prefix
: To display some text before the number, use|prefix=some prefix
{{nts|123456789.00123|prefix=approx. }}
→ approx. १२,३४,५६,७८९.००१२३
format
: To retain a number's format, use|format=no
{{nts|123456789.00123}}
→ १२,३४,५६,७८९.००१२३{{nts|123456789.00123|format=no}}
→ 123456789.00123
debug
: To display the sort key, use|debug=yes
.{{nts|123456789.00123|debug=yes}}
→ &10000000123456789001230१२,३४,५६,७८९.००१२३{{nts|-123456789.00123|debug=yes}}
→ फलकम्:Number table sorting/negative−१२,३४,५६,७८९.००१२३
Apart from the added thousands separators the numbers are formatted as supplied (scientific notation or not, leading and trailing zeros, and a zero before the decimal point or not). This formatting does not affect the sorted order except for numbers not satisfying the limitations mentioned below.
Limitations
सम्पादयतु- Any subset of numbers larger than 1×1016 are sorted as greater than 1×1016 but this subset is sorted alphabetically.
- Any subset of numbers smaller than -1×1016 are sorted as less than -1×1016 but this subset is sorted alphabetically.
- If a non-numeric value is given as the first unnamed parameter the results are undefined.
- There is a maximum of 6 digits after the decimal separator. Positive numbers with more than 6 decimal digits should sort correctly but the results for negative numbers with more that 6 decimal digits is undefined.
- A prefix (using the
prefix
parameter) does not affect the sort order.
Examples
सम्पादयतु{{nts|123456789.00123}}
→ <span style="display:none">&0000000123456789.001230</span>123,456,789.00123
For text which follows a number, {{nts|123,456}} as of 2012
displays 123,456 as of 2012
with a numerical sort key of 123456
. This forces numerical sorting in the cell using this value instead of the default alphabetical sorting.
Below are more examples, some of which illustrate the limitations listed above.
markup | sortkey and number | error spillover |
---|---|---|
{{nts|debug=yes}} |
||
{{nts||debug=yes}} |
||
{{nts|between 2 and 3|debug=yes}} |
{{Number table sorting/वाचनिकदोषः : अज्ञातशब्दः between | 1=वाचनिकदोषः : अज्ञातशब्दः between
}}between २ and ३ |
{{nts|10|prefix=approx.{{sp}}|debug=yes}} |
&10000000000000010000000approx. १० | |
{{nts|-5|debug=yes}} |
फलकम्:Number table sorting/negative−५ | |
{{nts|-4|debug=yes}} |
फलकम्:Number table sorting/negative−४ | |
{{nts|-73|debug=yes}} |
फलकम्:Number table sorting/negative−७३ | |
{{nts|-67|debug=yes}} |
फलकम्:Number table sorting/negative−६७ | |
{{nts|-20345678901234567.12345678|debug=yes}} |
फलकम्:Number table sorting/negative−२०,३४,५६,७८,९०,१२,३४,५७०.०००००००० | |
{{nts|123.456e3|debug=yes}} |
&10000000000123456000000१,२३,४५६ | |
{{nts|123.456e2|debug=yes}} |
&10000000000012345600000१२,३४५.६ | |
{{nts|20345678901234567.12345678|debug=yes}} |
~२०,३४,५६,७८,९०,१२,३४,५७०.०००००००० | |
{{nts|100345678901234567.12345678|debug=yes}} |
~१,००,३४,५६,७८,९०,१२,३४,५६०.०००००००० | |
{{nts|1234567890123456.12345678|debug=yes}} |
&11234567890123500000000१,२३,४५,६७,८९,०१,२३,४५६.०००००००० | |
{{nts|234567890123456.12345678|debug=yes}} |
&10234567890123460031250२३,४५,६७,८९,०१,२३,४५६.१२०००००० | |
{{nts|34567890123456.12345678|debug=yes}} |
&10034567890123456000000३,४५,६७,८९,०१,२३,४५६.१२५००००० | |
{{nts|4567890123456.12345678|debug=yes}} |
&10004567890123456099609४५,६७,८९,०१,२३,४५६.१२३००००० | |
{{nts|567890123456.12345678|debug=yes}} |
&10000567890123456119995५,६७,८९,०१,२३,४५६.१२३४०००० | |
{{nts|67890123456.12345678|debug=yes}} |
&10000067890123456123001६७,८९,०१,२३,४५६.१२३४६००० | |
{{nts|7890123456.12345678|debug=yes}} |
&10000007890123456123499७,८९,०१,२३,४५६.१२३४५७०० | |
{{nts|890123456.12345678|debug=yes}} |
&10000000890123456123460८९,०१,२३,४५६.१२३४५६८० | |
{{nts|90123456.12345678|debug=yes}} |
&10000000090123456123456९,०१,२३,४५६.१२३४५६७८ | |
{{nts|0123456.12345678|debug=yes}} |
&10000000000123456123456०१,२३,४५६.१२३४५६७८ | |
{{nts|123456.12345678|debug=yes}} |
&10000000000123456123456१,२३,४५६.१२३४५६७८ | |
{{nts|23456.12345678|debug=yes}} |
&10000000000023456123456२३,४५६.१२३४५६७८ | |
{{nts|3456.12345678|debug=yes}} |
&10000000000003456123456३,४५६.१२३४५६७८ | |
{{nts|456.12345678|debug=yes}} |
&10000000000000456123456४५६.१२३४५६७८ | |
{{nts|56.12345678|debug=yes}} |
&10000000000000056123456५६.१२३४५६७८ | |
{{nts|6.12345678|debug=yes}} |
&10000000000000006123456६.१२३४५६७८ | |
{{nts|.12345678|debug=yes}} |
&10000000000000000123456.१२३४५६७८ | |
{{nts|0.12345678|debug=yes}} |
&10000000000000000123456०.१२३४५६७८ | |
{{nts|0.02345678|debug=yes}} |
&10000000000000000023456०.०२३४५६७८ | |
{{nts|0.00345678|debug=yes}} |
&10000000000000000003456०.००३४५६७८ | |
{{nts|0.00045678|debug=yes}} |
&10000000000000000000456०.०००४५६७८ | |
{{nts|0.00005678|debug=yes}} |
&10000000000000000000056०.००००५६७८ | |
{{nts|0.00000678|debug=yes}} |
&10000000000000000000006०.०००००६७८ | |
{{nts|0.00000078|debug=yes}} |
&10000000000000000000000०.००००००७८ | |
{{nts|0.00000008|debug=yes}} |
&10000000000000000000000०.०००००००८ | |
{{nts|.00000008|debug=yes}} |
&10000000000000000000000.०००००००८ | |
{{nts|0|debug=yes}} |
&10000000000000000000000० |
See also
सम्पादयतु- {{Ntsh}} - same as this template, but does not display (hides) the number
- {{Ntsc}} - for converted units, sorts by the first number
- {{Ntss}} - same as Nts, but allows for the number to be scaled
- {{Convert}} - has a sortable option
- {{Dts}} - for sorting dates
- {{Sms}}