summaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-12-03 16:33:12 +0100
committerBram Moolenaar <Bram@vim.org>2015-12-03 16:33:12 +0100
commitb00da1d6d1655cb6e415f84ecc3be5ff3b790811 (patch)
treeb7ee0b6575e0f80ad0a2bc15739063d32329d565 /runtime/doc
parent4649ded2877508fe343cbcf6f7e7fd277be0aab3 (diff)
downloadvim-git-b00da1d6d1655cb6e415f84ecc3be5ff3b790811.tar.gz
patch 7.4.951v7.4.951
Problem: Sorting number strings does not work as expected. (Luc Hermitte) Solution: Add the 'N" argument to sort()
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/eval.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 9442996be..2e89098a6 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -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: >