listLast

Gets the last element of a list.

listLast(list [, delimiters, includeEmptyValues ]) → returns string

listLast Argument Reference

list string
Required

A list or a variable that contains a list.

delimiters string
Default: ,

A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter; you cannot specify a multicharacter delimiter.

includeEmptyValues boolean

Set to true to include empty values.
Values:
  • true
  • false

Examples sample code invoking the listLast function

A very basic listLast example

listLast("one,two,three,four");

Expected Result: four

A more advanced listLast example

listLast("one/two\three/four", "\/");

Expected Result: four


Fork me on GitHub