From 553e011320798af097e8de95a1e2a1d2ed6a1a3e Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 21 Jan 2007 22:47:36 +0000 Subject: 23118: improve sorting to make it work with locales --- Doc/Zsh/expn.yo | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'Doc') diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index c9c67bebb..c18a297ad 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -723,9 +723,10 @@ example by using `tt(${(AA)=)var(name)tt(=)...tt(})' to activate field splitting, when creating an associative array. ) item(tt(a))( -With tt(o) or tt(O), sort in array index order. Note that `tt(oa)' is -therefore equivalent to the default but `tt(Oa)' is useful for -obtaining an array's elements in reverse order. +Sort in array index order; when combined with `tt(O)' sort in reverse +array index order. Note that `tt(a)' is therefore equivalent to the +default but `tt(Oa)' is useful for obtaining an array's elements in reverse +order. ) item(tt(c))( With tt(${#)var(name)tt(}), count the total number of characters in an array, @@ -750,7 +751,7 @@ Join the words of arrays together using newline as a separator. This is a shorthand for `tt(pj:\n:)'. ) item(tt(i))( -With tt(o) or tt(O), sort case-independently. +Sort case-insensitively. May be combined with `tt(n)' or `tt(O)'. ) item(tt(k))( If var(name) refers to an associative array, substitute the em(keys) @@ -763,13 +764,25 @@ item(tt(L))( Convert all letters in the result to lower case. ) item(tt(n))( -With tt(o) or tt(O), sort numerically. +Sort decimal numbers numerically; if the first differing +characters of two test strings are not digits, sorting +is lexical. Numbers with initial zeroes +are sorted before those without. Hence the array `tt(foo1 foo02 +foo2 foo3 foo20 foo23)' is sorted into the order shown. Trailing +non-digits are not sorted; the order of `tt(2foo)' and `tt(2bar)' +is not defined. May be combined with `tt(i)' or `tt(O)'. ) item(tt(o))( -Sort the resulting words in ascending order. +Sort the resulting words in ascending order; if this appears on its +own the sorting is lexical and case-sensitive (unless the locale +renders it case-insensitive). Sorting in ascending order is the +default for other forms of sorting, so this is ignored if combined +with `tt(a)', `tt(i)' or `tt(n)'. ) item(tt(O))( -Sort the resulting words in descending order. +Sort the resulting words in descending order; `tt(O)' without `tt(a)', +`tt(i)' or `tt(n)' sorts in reverse lexical order. May be combined +with `tt(a)', `tt(i)' or `tt(n)' to reverse the order of sorting. ) item(tt(P))( This forces the value of the parameter var(name) to be interpreted as a -- cgit 1.4.1