Skip to content

sortlib

Sort sorts all elements of an array in place, from low to high or, after SortDown, from high to low; SortUp sets the ascending order again, which is the start value. It sorts arrays of a single type: bytes, words, longs, quicks, floats and strings. Arrays of NewTypes and list arrays cannot be sorted this way; SortList sorts a list array.

Dim n$(4)
n$(0)="pear" : n$(1)="apple" : n$(2)="plum" : n$(3)="fig" : n$(4)="kiwi"
Sort n$()

A string element that was never given a value sorts as the empty string.

Based on the sortlib guide by Acid Software.

Library number 110.

Commands

Sort

Sorts all elements of the array, in the order SortUp or SortDown set.

Statement. Help text: Arrayname()
Arguments: array()

SortDown

Makes the following Sort commands sort from high to low.

Statement. No help text.
No arguments.

SortUp

Makes the following Sort commands sort from low to high; the start value.

Statement. No help text.
No arguments.