Contents > CFML Reference > ColdFusion Functions > ListInsertAt PreviousNext

ListInsertAt

Inserts an element in a list.

A copy of the list, with value inserted at the specified position.

List functions

ListInsertAt(list, position, value [, delimiters ])

ListDeleteAt, ListAppend, ListPrepend, ListSetAt

Parameter

Description

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. Character(s) that separate list elements. Default: comma.

If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter.

When inserting an element, ColdFusion inserts a delimiter. If delimiters contains more than one delimiter, ColdFusion uses the first delimiter in the string; if delimiters is omitted, ColdFusion uses a comma.

ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.

<!--- This example shows ListInsertAt --->
<cfquery name = "GetParkInfo" datasource = "cfsnippets">
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")>

Contents > CFML Reference > ColdFusion Functions > ListInsertAt PreviousNext

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.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functb13.htm