Getting started with Arrays in ColdFusion

Readability

Getting started with Arrays in ColdFusion

The fol­low­ing exam­ples show how you can get started with using the var­i­ous Array func­tions in ColdFusion.

Cre­at­ing a new Array in ColdFusion

The fol­low­ing exam­ple shows how you can cre­ate a sim­ple array in Cold­Fu­sion using the arrayNew() function:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 1 of 1 rows
1) Xan­der Crews

The pre­vi­ous exam­ple cre­ates an empty, 1-​dimensional array. If you want to cre­ate a 2-​dimensional (or 3-​dimensional array) you can pass the num­ber of dimen­sions to the arrayNew() func­tion, as seen in the fol­low­ing example:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array - Top 1 of 1 rows
1) [array]
	1) [array]
		1) Xander Crews   

You can also cre­ate and pop­u­late an array using the [] nota­tion, as seen in the fol­low­ing example:



The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 2 of 2 rows
1) Xan­der Crews
2) Wen­dell Stamps

Or you can cre­ate and pop­u­late an array using the listToArray() func­tion, as seen in the fol­low­ing example:



The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 2 of 2 rows
1) Xan­der Crews
2) Wen­dell Stamps

Mod­i­fy­ing items in an Array in ColdFusion

The fol­low­ing exam­ple shows how you can append items to the end of an array using the arrayAppend() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 3 of 3 rows
1) Xan­der Crews
2) Wen­dell Stamps
3) Grace Ryan

The fol­low­ing exam­ple shows how you can prepend items to the begin­ning of an array using the arrayPrepend() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 3 of 3 rows
1) Grace Ryan
2) Xan­der Crews
3) Wen­dell Stamps

The fol­low­ing exam­ple shows how you can over­write an item in an array using the array access operator:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 2 of 2 rows
1) Xan­der Crews
2) Grace Ryan

The fol­low­ing exam­ple shows how you can over­write items in an array using the arraySet() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 2 of 2 rows
1) Xan­der Crews
2) Grace Ryan

You can also resize an array using the arraySet() func­tion, as seen in the fol­low­ing example:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 5 of 5 rows
1) Xan­der Crews
2) Grace Ryan
3) Grace Ryan
4) Grace Ryan
5) Grace Ryan

The fol­low­ing exam­ple shows how you can insert items at a spe­cific index in an array using the arrayInsertAt() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 3 of 3 rows
1) Xan­der Crews
2) Grace Ryan
3) Wen­dell Stamps

The fol­low­ing exam­ple shows how you can delete an item at a spe­cific index in an array using the arrayDeleteAt() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 1 of 1 rows
1) Wen­dell Stamps

You can also delete a spe­cific item from an array pass­ing the ele­ment to be removed instead of pass­ing an index using the arrayDelete() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 1 of 1 rows
1) Wen­dell Stamps

You can delete all items from an array using the arrayClear() function:



success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array [empty]

Deter­min­ing the num­ber of items in an Array in ColdFusion

The fol­low­ing exam­ple shows how you can deter­mine the num­ber of items in an Array using the arrayLen() function:


Array has #arrayLen(namesArr)# items:

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

Array has 2 items:

array — Top 2 of 2 rows
1) Xan­der Crews
2) Wen­dell Stamps

You can check whether the array is empty using the arrayIsEmpty() function:


Array is empty? #arrayIsEmpty(namesArr)#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

Array is empty? NO

array — Top 2 of 2 rows
1) Xan­der Crews
2) Wen­dell Stamps

Swap­ping items in an Array in ColdFusion

The fol­low­ing exam­ple shows how you can swap items at two indices in an array using the arraySwap() function:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 3 of 3 rows
1) Grace Ryan
2) Wen­dell Stamps
3) Xan­der Crews

Deter­min­ing whether an Array ele­ment is defined in ColdFusion

The fol­low­ing exam­ple shows how you can deter­mine if an array ele­ment is defined using the arrayIsDefined() function:




Array index 1 is defined? #arrayIsDefined(namesArr, 1)#
Array index 4 is defined? #arrayIsDefined(namesArr, 4)#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

Array index 1 is defined? YES
Array index 4 is defined? NO

array — Top 5 of 5 rows
1) Xan­der Crews
2) Wen­dell Stamps
3) Grace Ryan
4) [unde­fined array ele­ment] Ele­ment 4 is unde­fined in a Java object of type class coldfusion.runtime.Array.
5) Arthur Watley

Cal­cu­lat­ing an array’s aver­age, sum, max­i­mum and min­i­mum using ColdFusion

The fol­low­ing exam­ple shows how you can cal­cu­late a numeric array’s aver­age value, min­i­mum value, max­i­mum value, and sum using the arrayAvg(), arrayMin(), arrayMax(), and arraySum() functions:



Array average is #arrayAvg(numArr)#
Array average is #arraySum(numArr)#
Array minimum is #arrayMin(numArr)#
Array maximum is #arrayMax(numArr)#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

Array aver­age is 111.681818182
Array aver­age is 1228.5
Array min­i­mum is 7.82
Array max­i­mum is 590

array — Top 11 of 11 rows
1) 28.72
2) 25.25
3) 590
4) 315
5) 35.2
6) 143.9
7) 27.49
8) 34.58
9) 9.95
10) 7.82
1110.59

Sort­ing an array using ColdFusion

The fol­low­ing exam­ple shows how you can sort an array using the arraySort() function:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 6 of 6 rows
1) Arthur
2) Grace
3) Stan
4) Taqu’il
5) Wen­dell
6) Xander

If you are using a numeric array you can set the sortType attribute to numeric, as seen in the fol­low­ing example:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 11 of 11 rows
1) 7.82
2) 9.95
3) 10.59
4) 25.25
5) 27.49
6) 28.72
7) 34.58
8) 35.2
9) 143.9
10) 315
11590

You can also sort an array in descend­ing order by spec­i­fy­ing an optional third argu­ment, sortOrder, as seen in the fol­low­ing example:




The pre­vi­ous exam­ple out­puts the fol­low­ing text:

array — Top 11 of 11 rows
1) 590
2) 315
3) 143.9
4) 35.2
5) 34.58
6) 28.72
7) 27.49
8) 25.25
9) 10.59
10) 9.95
117.82

Resiz­ing an Array in ColdFusion

The fol­low­ing exam­ple shows how you can resize an array using the arrayResize() function:



success = #success#
success = #success#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

suc­cess = YES

array — Top 3 of 3 rows
1) Xan­der
2) Wen­dell
3) Grace

suc­cess = YES

array — Top 5 of 5 rows
1) Xan­der
2) Wen­dell
3) Grace
4) [unde­fined array ele­ment] Ele­ment 4 is unde­fined in a Java object of type class coldfusion.runtime.Array.
5) [unde­fined array ele­ment] Ele­ment 5 is unde­fined in a Java object of type class coldfusion.runtime.Array.

Deter­min­ing if a vari­able in an Array in ColdFusion

The fol­low­ing exam­ple shows how you can deter­mine if a vari­able is an array object using the isArray() function:


namesArr is array? #isArray(namesArr)#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

name­sArr is array? YES

You can also check if an array is 1-​dimensional, 2-​dimensional, or 3-​dimensional by pass­ing an optional sec­ond argu­ment, num­ber, to the isArray() func­tion, as seen in the fol­low­ing example:



namesArr is array? #isArray(namesArr)#
namesArr is 1-dimensional array: #isArray(namesArr, 1)#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

name­sArr is array? YES
name­sArr is 1-​dimensional array: YES

Deter­min­ing if an item is in an Array in ColdFusion

The fol­low­ing exam­ple shows how you can deter­mine if an item exists in an array using Cold­Fu­sion and the arrayContains(), arrayFind(), and arrayFindNoCase() functions:



arrayContains('wendell'): #arrayContains(namesArr, 'wendell')#
arrayContains('wendell stamps'): #arrayContains(namesArr, 'wendell stamps')#
arrayContains('Wendell Stamps'): #arrayContains(namesArr, 'Wendell Stamps')#
arrayFind('wendell'): #arrayFind(namesArr, 'wendell')#
arrayFind('wendell stamps'): #arrayFind(namesArr, 'wendell stamps')#
arrayFindNoCase('wendell'): #arrayFind(namesArr, 'wendell')#
arrayFindNoCase('Wendell Stamps'): #arrayFind(namesArr, 'Wendell Stamps')#

The pre­vi­ous exam­ple out­puts the fol­low­ing text:

arrayContains(‘Wendell’): NO
arrayContains(‘wendell stamps’): NO
arrayContains(‘Wendell Stamps’): YES

arrayFind(‘wendell’): 0
arrayFind(‘wendell stamps’): 0
arrayFindNoCase(‘wendell’): 0
arrayFindNoCase(‘Wendell Stamps’): 2

The arrayContains() func­tion searches an array for the pres­ence of a spec­i­fied object and returns a Boolean value if the spec­i­fied object exists in the array. The func­tion searches sim­ple objects such as strings and num­bers or com­plex objects such as struc­tures. String searches are case-​sensitive.
The arrayFind() func­tion per­forms a case-​sensitive search on an array for a spec­i­fied object and returns the index in the array of the first match, or 0 if there is no match. The func­tion can search for sim­ple objects such as strings or num­bers and com­plex objects such as struc­tures.
The arrayFindNoCase() func­tion per­forms a case-​insensitive search on an array for a spec­i­fied object and returns the index in the array of the first match, or 0 if there is no match. The func­tion can search for sim­ple objects such as strings or num­bers and com­plex objects such as structures.

The following examples show how you can get started with using the various Array functions in ColdFusion.

Creating a new Array in ColdFusion

The following example shows how you can create a simple array in ColdFusion using the arrayNew() function:

<cfset namesArr = arrayNew(1) />
<cfset namesArr[1] = "Xander Crews" />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array – Top 1 of 1 rows
1) Xander Crews

The previous example creates an empty, 1-dimensional array. If you want to create a 2-dimensional (or 3-dimensional array) you can pass the number of dimensions to the arrayNew() function, as seen in the following example:

<cfset namesArr = arrayNew(3) />
<cfset namesArr[1][1][1] = "Xander Crews" />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array - Top 1 of 1 rows
1) [array]
	1) [array]
		1) Xander Crews   

You can also create and populate an array using the [] notation, as seen in the following example:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array – Top 2 of 2 rows
1) Xander Crews
2) Wendell Stamps

Or you can create and populate an array using the listToArray() function, as seen in the following example:

<cfset namesArr = listToArray("Xander Crews,Wendell Stamps") />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array – Top 2 of 2 rows
1) Xander Crews
2) Wendell Stamps

Modifying items in an Array in ColdFusion

The following example shows how you can append items to the end of an array using the arrayAppend() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayAppend(namesArr, "Grace Ryan") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 3 of 3 rows
1) Xander Crews
2) Wendell Stamps
3) Grace Ryan

The following example shows how you can prepend items to the beginning of an array using the arrayPrepend() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayPrepend(namesArr, "Grace Ryan") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 3 of 3 rows
1) Grace Ryan
2) Xander Crews
3) Wendell Stamps

The following example shows how you can overwrite an item in an array using the array access operator:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset namesArr[2] = "Grace Ryan" />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array – Top 2 of 2 rows
1) Xander Crews
2) Grace Ryan

The following example shows how you can overwrite items in an array using the arraySet() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arraySet(namesArr, 2, 2, "Grace Ryan") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 2 of 2 rows
1) Xander Crews
2) Grace Ryan

You can also resize an array using the arraySet() function, as seen in the following example:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arraySet(namesArr, 2, 5, "Grace Ryan") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 5 of 5 rows
1) Xander Crews
2) Grace Ryan
3) Grace Ryan
4) Grace Ryan
5) Grace Ryan

The following example shows how you can insert items at a specific index in an array using the arrayInsertAt() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayInsertAt(namesArr, 2, "Grace Ryan") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 3 of 3 rows
1) Xander Crews
2) Grace Ryan
3) Wendell Stamps

The following example shows how you can delete an item at a specific index in an array using the arrayDeleteAt() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayDeleteAt(namesArr, 1) />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 1 of 1 rows
1) Wendell Stamps

You can also delete a specific item from an array passing the element to be removed instead of passing an index using the arrayDelete() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayDelete(namesArr, "Xander Crews") />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 1 of 1 rows
1) Wendell Stamps

You can delete all items from an array using the arrayClear() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfset success = arrayClear(namesArr) />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

success = YES

array [empty]

Determining the number of items in an Array in ColdFusion

The following example shows how you can determine the number of items in an Array using the arrayLen() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfoutput>Array has #arrayLen(namesArr)# items:<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

Array has 2 items:

array – Top 2 of 2 rows
1) Xander Crews
2) Wendell Stamps

You can check whether the array is empty using the arrayIsEmpty() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfoutput>Array is empty? #arrayIsEmpty(namesArr)#<br/></cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

Array is empty? NO

array – Top 2 of 2 rows
1) Xander Crews
2) Wendell Stamps

Swapping items in an Array in ColdFusion

The following example shows how you can swap items at two indices in an array using the arraySwap() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps", "Grace Ryan"] />
<cfset arraySwap(namesArr, 1, 3) />
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

array – Top 3 of 3 rows
1) Grace Ryan
2) Wendell Stamps
3) Xander Crews

Determining whether an Array element is defined in ColdFusion

The following example shows how you can determine if an array element is defined using the arrayIsDefined() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps", "Grace Ryan"] />
<cfset namesArr[5] = "Arthur Watley" />
<cfoutput>
Array index 1 is defined? #arrayIsDefined(namesArr, 1)#<br/>
Array index 4 is defined? #arrayIsDefined(namesArr, 4)#<br/>
</cfoutput>
<cfdump var="#namesArr#" format="text" />

The previous example outputs the following text:

Array index 1 is defined? YES
Array index 4 is defined? NO

array – Top 5 of 5 rows
1) Xander Crews
2) Wendell Stamps
3) Grace Ryan
4) [undefined array element] Element 4 is undefined in a Java object of type class coldfusion.runtime.Array.
5) Arthur Watley

Calculating an array’s average, sum, maximum and minimum using ColdFusion

The following example shows how you can calculate a numeric array’s average value, minimum value, maximum value, and sum using the arrayAvg(), arrayMin(), arrayMax(), and arraySum() functions:

<cfset numArr = [28.72, 25.25, 590, 315, 35.2, 143.9, 27.49, 34.58, 9.95, 7.82, 10.59] />
<cfoutput>
Array average is #arrayAvg(numArr)#<br/>
Array average is #arraySum(numArr)#<br/>
Array minimum is #arrayMin(numArr)#<br/>
Array maximum is #arrayMax(numArr)#<br/>
</cfoutput>
<cfdump var="#numArr#" format="text" />

The previous example outputs the following text:

Array average is 111.681818182
Array average is 1228.5
Array minimum is 7.82
Array maximum is 590

array – Top 11 of 11 rows
1) 28.72
2) 25.25
3) 590
4) 315
5) 35.2
6) 143.9
7) 27.49
8) 34.58
9) 9.95
10) 7.82
11) 10.59

Sorting an array using ColdFusion

The following example shows how you can sort an array using the arraySort() function:

<cfset nameArr = ["Xander", "Wendell", "Grace", "Arthur", "Stan", "Taqu'il"] />
<cfset arraySort(nameArr, "textNoCase") />
<cfdump var="#nameArr#" format="text" />

The previous example outputs the following text:

array – Top 6 of 6 rows
1) Arthur
2) Grace
3) Stan
4) Taqu’il
5) Wendell
6) Xander

If you are using a numeric array you can set the sortType attribute to numeric, as seen in the following example:

<cfset numArr = [28.72, 25.25, 590, 315, 35.2, 143.9, 27.49, 34.58, 9.95, 7.82, 10.59] />
<cfset arraySort(numArr, "numeric") />
<cfdump var="#numArr#" type="text" />

The previous example outputs the following text:

array – Top 11 of 11 rows
1) 7.82
2) 9.95
3) 10.59
4) 25.25
5) 27.49
6) 28.72
7) 34.58
8) 35.2
9) 143.9
10) 315
11) 590

You can also sort an array in descending order by specifying an optional third argument, sortOrder, as seen in the following example:

<cfset numArr = [28.72, 25.25, 590, 315, 35.2, 143.9, 27.49, 34.58, 9.95, 7.82, 10.59] />
<cfset arraySort(numArr, "numeric", "desc") />
<cfdump var="#numArr#" type="text" />

The previous example outputs the following text:

array – Top 11 of 11 rows
1) 590
2) 315
3) 143.9
4) 35.2
5) 34.58
6) 28.72
7) 27.49
8) 25.25
9) 10.59
10) 9.95
11) 7.82

Resizing an Array in ColdFusion

The following example shows how you can resize an array using the arrayResize() function:

<cfset nameArr = ["Xander", "Wendell", "Grace"] />
<cfset success = arrayResize(nameArr, 1) />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#nameArr#" format="text" />
 
<cfset success = arrayResize(nameArr, 5) />
<cfoutput>success = #success#<br/></cfoutput>
<cfdump var="#nameArr#" format="text" />

The previous example outputs the following text:

success = YES

array – Top 3 of 3 rows
1) Xander
2) Wendell
3) Grace

success = YES

array – Top 5 of 5 rows
1) Xander
2) Wendell
3) Grace
4) [undefined array element] Element 4 is undefined in a Java object of type class coldfusion.runtime.Array.
5) [undefined array element] Element 5 is undefined in a Java object of type class coldfusion.runtime.Array.

Determining if a variable in an Array in ColdFusion

The following example shows how you can determine if a variable is an array object using the isArray() function:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfoutput>namesArr is array? #isArray(namesArr)#</cfoutput>

The previous example outputs the following text:

namesArr is array? YES

You can also check if an array is 1-dimensional, 2-dimensional, or 3-dimensional by passing an optional second argument, number, to the isArray() function, as seen in the following example:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfoutput>
namesArr is array? #isArray(namesArr)#<br/>
namesArr is 1-dimensional array: #isArray(namesArr, 1)#<br/>
</cfoutput>

The previous example outputs the following text:

namesArr is array? YES
namesArr is 1-dimensional array: YES

Determining if an item is in an Array in ColdFusion

The following example shows how you can determine if an item exists in an array using ColdFusion and the arrayContains(), arrayFind(), and arrayFindNoCase() functions:

<cfset namesArr = ["Xander Crews", "Wendell Stamps"] />
<cfoutput>
arrayContains('wendell'): #arrayContains(namesArr, 'wendell')#<br/>
arrayContains('wendell stamps'): #arrayContains(namesArr, 'wendell stamps')#<br/>
arrayContains('Wendell Stamps'): #arrayContains(namesArr, 'Wendell Stamps')#<br/>
 
arrayFind('wendell'): #arrayFind(namesArr, 'wendell')#<br/>
arrayFind('wendell stamps'): #arrayFind(namesArr, 'wendell stamps')#<br/>
arrayFindNoCase('wendell'): #arrayFind(namesArr, 'wendell')#<br/>
arrayFindNoCase('Wendell Stamps'): #arrayFind(namesArr, 'Wendell Stamps')#<br/>
</cfoutput>

The previous example outputs the following text:

arrayContains(‘Wendell’): NO
arrayContains(‘wendell stamps’): NO
arrayContains(‘Wendell Stamps’): YES

arrayFind(‘wendell’): 0
arrayFind(‘wendell stamps’): 0
arrayFindNoCase(‘wendell’): 0
arrayFindNoCase(‘Wendell Stamps’): 2

The arrayContains() function searches an array for the presence of a specified object and returns a Boolean value if the specified object exists in the array. The function searches simple objects such as strings and numbers or complex objects such as structures. String searches are case-sensitive.
The arrayFind() function performs a case-sensitive search on an array for a specified object and returns the index in the array of the first match, or 0 if there is no match. The function can search for simple objects such as strings or numbers and complex objects such as structures.
The arrayFindNoCase() function performs a case-insensitive search on an array for a specified object and returns the index in the array of the first match, or 0 if there is no match. The function can search for simple objects such as strings or numbers and complex objects such as structures.

Leave a Reply