Standard Function Library - Details - Miscellaneous Functions
XstCompareStrings ( @addrString1, op, addrString2, flags )
XstQuickSort ( ANY x[], n[], low, high, flags )

XstCompareStrings  XstCompareStrings ( addrString1 , op , addrString2 , flags )
XstQuickSort()  XstQuickSort (@ sortArray [], @ orderArray [], first , last , flags )

Sort the contents of all or part of an array.

sortArray[] = array to sort all or part of
orderArray[] = optional array left with original indices
first = first element of region in sortArray[] to sort
last = last element of region in sortArray[] to sort
flags = see xst.DEC file : OR appropriate flags together
$$SortIncreasing vs $$SortDECreasing
$$SortAlphabetic vs $$SortAlphaNumeric
$$SortCaseSensitive vs $$SortCaseInsensitive

XstQuickSort() sorts the elements of sortArray[] between first and last. Depending on flags, the sorted elements are stored in increasing or DECreasing order, are sorted alphabetic or alphanumeric, and sorted case sensitive or case insensitive.

The data type of sortArray[] can be any of the following:


If orderArray[] enters XstQuickSort() with no elements, it is ignored. Otherwise it is dimensioned to the same size as sortArray[] , filled with 0,1,2,3,4,5... , then sorted in parallel with sortArray[] . When the sort is finished, it contains the original element number for every element in sortArray[] .

sortArray[] must be a one dimension array. orderArray[] must be a one dimensional XLONG array.

An error is generated if:
   last is less than first.
   first or last is less than zero
   first or last is greater than the upper bound of sortArray[]

Depending on the type of sortArray[] , XstQuickSort() calls internal functions that sort SLONG , XLONG , GIANT , DOUBLE , or STRING arrays. When sortArray[] is another type, a temporary array of the next larger type from this selection is created, the contents of sortArray[] are transferred to the temporary array, the sort is performed, then the contents are transferred back into the original array.