listLast

Gets the last element of a list.

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

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

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub