|
We can sort the contents of an array using SORT command. e.g. This example sorts the contents of array variable arr using as a sort key the part of every string starting at 10 for 5 characters. Sorting is not case sensitive. Start position and length parameters are optional. Sorting is not case sensitive. |
|
If any other sorting capability fails to satisfy your needs then use this version of SORT. It can sort an array in any imaginable way. The second parameter takes the name of a local function which is used by SORT to make the sort. This local function must have exactly two normal (IN) parameters. In the body of the function the user must compare the two parameters with < (or ls) for ascending order, or > (or gr) for descending order, and return the result of the comparison. e.g.
The two parameters can be processed in any way before the comparison |
|
Returns a sorted version of the contents of ArrExpr. The sort is alphabetical with no case sensitivity. It is used in array expressions. |
|
This version of sort can sort anything and not only dynamic arrays. The user provides a local function which handles element swapping and comparison for the command.
Example: As an example will sort a dynamic array using this generic version of sort:
|
|
Numerically sorts the elements of array arr. |
|
Returns the numerically sorted version of ArrExpr. It is used in array expressions. |