ListFind

Description

Determines the index of the first list element in which a specified value occurs. Case sensitive.

Returns

Index of the first list element that contains value, with matching case. If not found, returns zero. The search is case sensitive.

History

ColdFusion (2018 release): Introduced named parameters.

Category

List functions

Function syntax

ListFind(list, value [, delimiters, includeEmptyFields ])

See also

ListContains ListFindNoCaseLists  in  Data types- Developing guide in the Developing ColdFusion Applications

Parameters

Parameter

Description

includeEmptyFields

Optional. Set to yes to include empty values.

list

A list or a variable that contains one

value

A string, a number, or a variable that contains one. Item for which to search. The search is case sensitive.

delimiters

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.

History

ColdFusion (2018 release): Introduced named parameters.

Usage

ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.

Example

<cfscript>
       myList="Tokyo,Bangkok,bangkok,bangKok,Jakarta,Manila,Bangalore,Shanghai";
       myFind=ListFind(myList,"bangkok");
       WriteOutput(myFind); // Returns 3
</cfscript>

Output

3

 Adobe

Get help faster and easier

New user?