ArrayDeleteAt

Description

Deletes data from an array at an index position. When an array index is deleted, index positions are recalculated. For example, in an array that contains the months of the year, deleting index position [5] removes the entry for May. To then 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.

Category

Array functions

Syntax


ArrayDeleteAt(array, position) 

See also

ArrayInsertAt

Parameters

Parameter
Description
array
Name of an array in which to delete index data
position
Array position that contains data to delete

Example

<!--- This example shows ArrayDeleteAt --->

<html>

<head>

<title>ArrayDeleteAt Example</title>

</head>



<body>

<H3>ArrayDeleteAt Example</H3>

<P>

<!--- create an 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>

<!--- the formerly form third element, "Wednesday" is now the second element --->

<P>The second element is now: <cfoutput>#DaysArray[2]#</cfoutput>

</body>

</html>    



Banner.Novgorod.Ru