Returns a struct sorted by the top level keys in a structure.
Sorts using alphabetic or numeric sorting.
Lucee Function Reference
structtosorted()
Example
structtosorted(struct base,[any sortTypeOrSortFunc,[string sortOrder,[boolean localeSensitive]]]):struct
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 |
|---|---|---|---|---|
| base | struct | Yes | A structure with one field (an associative array). | |
| sortTypeOrSortFunc | any | No | text |
The following sort types are available: or a function to be used as a comparator function(key1, key2) |
| sortOrder | string | No | asc |
Sort direction: |
| localeSensitive | boolean | No | false | Use locale aware sort |