Whatever message this page gives is out now! Go check it out!
ListInsertAt(list, position, value [, delimiters, includeEmptyFields ])Parameter | Description |
includeEmptyFields | Optional. Set to yes to include empty values. |
list | A list or a variable that contains one. |
position | A positive integer or a variable that contains one. Position at which to insert element. The first list position is 1. |
value | An element or a list of elements. |
delimiters | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. |
<!--- This example shows ListInsertAt --->
<cfquery name = "GetParkInfo" datasource = "cfdocexamples">
SELECT PARKNAME,CITY,STATE
FROM PARKS
WHERE PARKNAME LIKE 'DE%'
</cfquery>
<cfset temp = ValueList(GetParkInfo.ParkName)>
<cfset insert_at_this_element = ListGetAt(temp, "3", ",")>
<cfoutput>
<p>The original list: #temp#
</cfoutput>
<cfset temp2 = ListInsertAt(Temp, "3", "my Inserted Value")><cfscript>
myList="Tokyo,Bangkok,Jakarta,Manila,Bangalore,Shanghai";
myInsert=ListInsertAt(myList,4,"Mumbai");
WriteOutput(myInsert); // Inserts Mumbai after Jakarta
</cfscript>