forked from aniani/vim
patch 7.4.951
Problem: Sorting number strings does not work as expected. (Luc Hermitte) Solution: Add the 'N" argument to sort()
This commit is contained in:
@@ -5803,6 +5803,10 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
|
||||
strtod() function to parse numbers, Strings, Lists, Dicts and
|
||||
Funcrefs will be considered as being 0).
|
||||
|
||||
When {func} is given and it is 'N' then all items will be
|
||||
sorted numerical. This is like 'n' but a string containing
|
||||
digits will be used as the number they represent.
|
||||
|
||||
When {func} is a |Funcref| or a function name, this function
|
||||
is called to compare items. The function is invoked with two
|
||||
items as argument and must return zero if they are equal, 1 or
|
||||
@@ -5817,6 +5821,11 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
|
||||
on numbers, text strings will sort next to each other, in the
|
||||
same order as they were originally.
|
||||
|
||||
The sort is stable, items which compare equal (as number or as
|
||||
string) will keep their relative position. E.g., when sorting
|
||||
on numbers, text strings will sort next to each other, in the
|
||||
same order as they were originally.
|
||||
|
||||
Also see |uniq()|.
|
||||
|
||||
Example: >
|
||||
|
||||
Reference in New Issue
Block a user