Gets a list element at a specified position.

listGetAt(list, position [, delimiters [, includeEmptyValues]]) → returns string

Argument Reference

list string

position numeric

delimiter string
Default: ,

includeEmptyValues boolean
Default: false

Sample code invoking the listGetAt function

Returns the 2nd element in the list

listGetAt("foo,bar,lorem,ipsum", 2)

Expected Result: bar

Returns the 3rd element in the list using a custom delimiter

listGetAt("foo,bar|lorem,ipsum|me|something", 3, "|")

Expected Result: me

Returns the 4th element in the list, treating the empty element as a value

listGetAt("foo,bar,,lorem,ipsum", 4, ",", true)

Expected Result: lorem

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

Fork me on GitHub