listIndexExists

Determines whether that index exists in the given list or not

listIndexExists(list, index [, delimiter] [, includeEmptyFields]) → returns boolean

Member Function Syntax

list.listIndexExists(index [, delimiter] [, includeEmptyFields])

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

list string
Required

index numeric
Required

delimiter string
Default: ,

includeEmptyFields boolean

Examples
Sample code invoking the listIndexExists function

Check whether the index is exists or not in list

<cfset list="Apple,Orange,Banana,Graphs">
<cfif listIndexExists(list,2)>
	<cfset list=listsetAt(list,2,"Goa")>
</cfif>
<cfoutput>#list#</cfoutput>

Expected Result: Apple,Goa,Banana,Graphs

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

Fork me on GitHub