listFind

Determines the index of the first list element in which a specified value occurs. Returns 0 if not found. Case-sensitive

listFind(list, value [, delimiters, includeEmptyValues]) → returns numeric

Member Function Syntax

list.listFind(value [, delimiters, includeEmptyValues])

Argument Reference

list string
Required

value string
Required

delimiters string
Default: ,

includeEmptyValues string
Default: false

Values:
  • true
  • false

Examples
Sample code invoking the listFind function

Find item in a list and return the index.

listFind("apple,orange,banana", "orange")

Expected Result: 2

Find item in a pipe delimited list and return the index.

listFind("apple|orange|banana", "orange", "|")

Expected Result: 2

listFind as a member function

fruits = "apple|orange|banana";
writeOutput(fruits.listFind("orange", "|"));

Expected Result: 2

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

Fork me on GitHub