Returns a sorted array of the top level keys in a structure.
Sorts using alphabetic or numeric sorting, and can sort based
on the values of any structure element.
Lucee object methods reference
Object Method Struct.sort
Struct.sort([any sortTypeOrSortFunc,[string sortOrder,[string pathToSubElement]]]):array
Category
struct,sort
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
| Name | Type | Required | Default Value | Description |
|---|---|---|---|---|
| sortTypeOrSortFunc | any | No | text |
define one of the following: or a function to be used as a comparator function(value1, value2, key1, key2) |
| sortOrder | string | No | asc |
sort direction: _- asc (default): ascending (a to z) sort order |
| pathToSubElement | string | No | String or a variable that contains one |