Array Sort

From MultiCharts
Jump to: navigation, search

Sorts, in either ascending or descending order, the range of elements, specified by the starting and ending indexes, of the specified one-dimensional array. For numerical arrays, the elements are sorted according to the values they contain. For string arrays, the elements are sorted according to the ASCII values of the string characters, with the first character of the string being the most significant. For sorting true/false array elements, the value of true is considered to be greater than the value of false.

Usage

Array_Sort(ArrayName,StartIndex,EndIndex,SortOrder)

Where:

ArrayName - an expression specifying the name of an array
StartIndex - a numerical expression specifying the starting index for the range
EndIndex - a numerical expression specifying the ending index for the range
SortOrder - a true/false value specifying the sort order; true specifies ascending order, and false specifies descending order

Example

Sort the elements in the segment of Array1 that begins at the index of 4 and ends at the index of 6, in ascending order:

Array_Sort(Array1,4,6,True);