Template talk:Lsc12
Adds thousands separators (commas), and leftpads with nbsp's for Javascript sorting. As a workaround to force proper sorting, numbers in the range 0 - 1000 have a "+" in front, for details see below.
Does not work for negative numbers: we get order 1, .. 9, -1, .., -9, 10, 11, 12, .., 99, -10, .., -99, 100, ..
6
a {{{1}}}
b {{{1}}}
6
results of lsc12 | other |
---|---|
6 | 6 |
7 | 7 |
1,048,576 | 1048576 |
1,234 | 1234 |
123 | 123 |
1,073,741,824 | 1073741824 |
65,536 | 65536 |
67,108,864 | 67108864 |
17,179,869,184 | 17179869184 |
results of lsc12 | other |
---|---|
6 | 6 |
7 | 7 |
1,048,576 | 1048576 |
-3 | -3 |
1,234 | 1234 |
1,073,741,824 | 1073741824 |
Expression error: Unrecognized word "a". | a1233 |
Expression error: Unrecognized word "a". | a1234 |
Expression error: Unrecognized word "a". | a1235 |
Reason for plus sign edit
Without the plus signs:
- If all numbers are >=1000 we always have alphabetic sorting, working fine.
- If all numbers are >=0 and <1000 we always have numeric sorting mode, working fine.
- If the numbers are >=0 and range from <1000 to >=1000 we have either numeric or alphabetic sorting mode:
- if the first number is <1000 sorting is based on the parts of the numbers before the first comma
- if the first number is >=1000 sorting works fine
- The desired two sorting results are numerically ascending and descending; if the sorting cycle is of length 4, two of these are the desired results; if the sorting cycle is of length 2, then 0, 1, or 2 of these may be desired results