Lucee object methods reference

Object Method Struct.toSorted

Returns a struct sorted by the top level keys in a structure.
Sorts using alphabetic or numeric sorting.
Struct.toSorted([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
sortTypeOrSortFunc any  No text The following sort types are available:
  • numeric: sorts numbers
  • text: sorts text alphabetically, taking case into account (case sensitive, defualt)
  • textNoCase: sorts text alphabetically, without regard to case (case insensitive)
    or a function to be used as a comparator
    function(key1, key2)
  • sortOrder string  No asc Sort direction:
  • asc (default): ascending (a to z) sort order
  • desc: descending (z to a) sort order
  • localeSensitive boolean  No false Use locale aware sort