ArrayDeleteAt
471
ArrayDeleteAt
Description
Deletes an element from an array.
When an element is deleted, ColdFusion recalculates index positions. For example, in an array
that contains the months of the year, deleting the element at position 5 removes the entry for
May. After this, to delete the entry for June, you would delete the element at position 5 (not 6).
Returns
True, on successful completion.
Category
Array functions
Function syntax
ArrayDeleteAt
(
array
,
position
)
See also
ArrayInsertAt
; “Functions for XML object management” in Chapter 35, “Using XML and
WDDX,” in
ColdFusion MX Developer’s Guide
History
ColdFusion MX:
•
Changed behavior: this function can be used on XML objects.
•
Changed thrown exceptions: this function can throw the InvalidArrayIndexException error.
Parameters
Throws
If this function attempts to delete an element at position 0, or specifies a value for
position
that
is greater than the size of
array
, this function throws an InvalidArrayIndexException error.
Example
<h3>ArrayDeleteAt Example</h3><p>
<!--- create an array --->
<cfset DaysArray = ArrayNew(2)>
<!--- populate an element or two --->
<cfset DaysArray[1][1] = "Monday">
<cfset DaysArray[2][1] = "Tuesday">
<cfset DaysArray[3][1] = "Wednesday">
<cfset DaysArray[1][2] = "April 12">
<cfset DaysArray[2][2] = "April 13">
<cfset DaysArray[3][2] = "April 14">
<p>This is what the array looks like before delete:<br>
Parameter
Description
array
Name of an array
position
Array position
Summary of Contents for COLFUSION MX 7-CFML
Page 1: ...COLDFUSION MX7 CFML Reference...
Page 20: ...20 Chapter 1 Reserved Words and Variables...
Page 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...
Page 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...
Page 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...
Page 411: ...cftable 411 cftable body html...
Page 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...
Page 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...
Page 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...
Page 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...
Page 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...
Page 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...
Page 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 903: ...Val 903 value Is the beginning numeric name form...
Page 932: ...932 Chapter 3 ColdFusion Functions...
Page 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...
Page 962: ...962 Chapter 5 Application CFC Reference...
Page 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...