ArrayDeleteAt

Deletes data from the specified array at the specified index position. Note that when an array index is deleted, index positions in the array are recalculated. For example, in an array containing the months of the year, deleting index position [5] removes the entry for May. If you then want to delete the entry for November, you delete index position [10], not [11], since the index positions were recalculated after index position [5] was removed.

Returns a Boolean TRUE on successful completion.

See also ArrayInsertAt.

Syntax

ArrayDeleteAt(array, position)
array

Name of the array in which you want to delete index data specified in position.

position

Array position containing the data you want to delete.

Example

<!--- This example shows ArrayDeleteAt --->
<HTML>
<HEAD>
<TITLE>ArrayDeleteAt Example</TITLE>
</HEAD>

<BODY>
<H3>ArrayDeleteAt Example</H3>

<P>
<!--- create a new array --->
<CFSET DaysArray = ArrayNew(1)>
<!--- populate an element or two --->
<CFSET DaysArray[1] = "Monday">
<CFSET DaysArray[2] = "Tuesday">
<CFSET DaysArray[3] = "Wednesday">
<!--- delete the second element --->
<P>Is the second element gone?: 
  <CFOUTPUT>#ArrayDeleteAt(DaysArray,2)#</CFOUTPUT>
<!--- note that the formerly form  third element, "Wednesday"
is now the second element --->
<P>The second element is now: <CFOUTPUT>#DaysArray[2]#</CFOUTPUT>

</BODY>
</HTML>       

1