Lucee Function Reference

listsort()

Sorts list elements according to a sort type and sort order.

Example

listsort(string list,[string sort_type,[string sort_order,[string delimiters,[boolean includeEmptyFields]]]]):string

Category

list,string,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
list string  Yes   a string list  
sort_type string  No textNoCase there are different sort types:
  • numeric - sort by number
  • text - sorts text alphabetically and case sensitive
  • textNoCase (default) - sorts text alphabetically and ignore case sensitivity  
  • sort_order string  No asc sort direction:
  • asc(default): ascending sort order
  • desc: descending sort order  
  • delimiters string  No , Characters that separate list elements. The default value is comma.  
    includeEmptyFields boolean  No   if set to true, empty values are included as well