How to insert an element at array specific position in ColdFusion

ArrayInsertAt() - insert array element at specific position


<!DOCTYPE html>

<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayInsertAt function example: how to insert array element at specific position</title>

<h2 style="color:hotpink">ArrayInsertAt Function Example</h2>

<cfset ColorArray = ArrayNew(1)>
<cfset Temp = ArrayAppend(ColorArray,"BurlyWood")>
<cfset Temp = ArrayAppend(ColorArray,"Chartreuse")>
<cfset Temp = ArrayAppend(ColorArray,"Chocolate")>
<cfdump var="#ColorArray#" label="Color Array">

<br />
<cfset Temp = ArrayInsertAt(ColorArray,2,"CadetBlue")>
<cfdump var="#ColorArray#" label="Color Array[After insert CadetBlue in position 2]">

More ColdFusion examples