Skip to main content

SORT

Sorts the elements of a dynamic array.

Synopsis

SORT(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array.

Description

The SORT function takes a dynamic array and returns a dynamic array with its elements sorted in ascending ASCII order. The null string and missing elements are sorted first. Numbers are sorted in ASCII order (for example: 12, 12.3, 123, 13) not numeric order. Numbers are converted to canonical form (removing leading signs and zeros) before sorting; numeric strings are not converted to canonical form.

SORT is provided for compatibility with D3 systems.

Examples

The following example uses the SORT function to sort a dynamic array:

cities="New York":@VM:"London":@VM:
"Chicago":@VM:"Boston":@VM:"Los Angeles"
PRINT SORT(cities)

returns BostonýChicagoýLondonýLos AngelesýNew York

See Also

FeedbackOpens in a new tab