|
ArraySort()
Sorts a single or multidimensional array.
Syntax
ArraySort(<aArray>, [<nIndex>],
[<lAscend>]) --> lResult
Arguments
<aArray> --> is the array to sort.
<nIndex> --> is the dimension to sort
on.
<lAscend> if passed as TRUE the array is
sorted in ascending sequence, otherwise it is sorted in descending
sequence. The default behaviour is to sort the list in ascending
order.
Returns
ArraySort() returns TRUE if the array was
successfully sorted.
Description
ArraySort() is an array function that sorts a
list of elements in ascending or descending sequence. The array
must be a simple list or a list with multiple elements. Each
element must be of the same type and there must be the same number
of elements in each dimension.
Examples
This example sorts a simple list containing three
numeric elements:
aArray := { 2, 3, 1 }
ArraySort(aArray)
* Result: aArray is { 1, 2, 3 }
aArray := {}
AADD(aArray, { "John", 32 } )
AADD(aArray, { "Peter", 35 } )
AADD(aArray, { "David", 33 } )
* Sort by 2nd dimension of array in descending
sequence.
ArraySort(aArray, 2, FALSE)
____________________________
Related Topics
AADD()
Array()
Business Function List
|