ArrayContains

Note:

As of ColdFusion (2021 release), CORBA has been removed. You can no longer use CORBA-related features, functions, and tags.

Description

Searches an array for the presence of a specified object. The function searches for simple objects such as strings and numbers or for complex objects such as structures. Simple object string searches are case-sensitive. This function does not support searches for COM and CORBA objects.

Returns

Yes, if the specified object exists in the array.

History

ColdFusion (2018 release): Changed parameter name elementToBeSearched to value.

Category

Function syntax

ArrayContains(array,value)

See also

Parameters

Parameter

Description

array

Array to search in.

value

Object to search for.

Example

<cfscript>
       myArray=[1,2,3,4,5];
       writeoutput(ArrayContains(myArray,3) & " | "); //returns True since 3 is a member of myArray
       writeoutput(ArrayContains(myArray,6)); //returns False since 6 is not a member of myArray
</cfscript>

Output

YES | NO

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online