| Contents > CFML Reference > ColdFusion Functions > ArrayInsertAt |
|
|
|
|
||
Inserts a value into an array. Array elements whose indexes are greater than the new position are incremented by one. The array length increases by one.
True, on successful completion.
ArrayInsertAt(array, position, value)
ColdFusion MX:
Parameter |
Description |
|---|---|
array |
Name of an array |
position |
Index position at which to insert value |
value |
Value to insert |
If this function attempts to insert 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.
<h3>ArrayInsertAt 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] = "Thursday"> <!--- add an element before position 3 ---> <p>Add an element before position 3: <cfoutput>#ArrayInsertAt(DaysArray,3,"Wednesday")#</cfoutput> <p>Now output the array as a list: <cfoutput>#ArrayToList(DaysArray)#</cfoutput> <!--- The array now has four elements. Element 3, "Thursday", has become element four --->
|
|
||
| Contents > CFML Reference > ColdFusion Functions > ArrayInsertAt |
|
|
ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functia7.htm
Comments
RogerDogerCF said on Apr 2, 2004 at 4:30 PM :