LISTAPPEND  
Description

Concatenates a list or element to a list.

 
Returns

A copy of the list, with value appended. If delimiter = "", returns a copy of the list, unchanged.

 
Category

List functions

 
Function syntax
ListAppend(list, value [, delimiters ])
 
See also

ListPrepend, ListInsertAt, ListGetAt, ListLast, ListSetAt; "Lists" in Chapter 3, "Using ColdFusion Variables," in ColdFusion MX Developer's Guide

 
Parameters

 
Usage

ColdFusion inserts a delimiter character before value.

The following table shows examples of ListAppend processing:

     
ListAppend('elem1,elem2', '' )

elem1,elem2,

Appended element is empty; delimiter is last character in list; list length is 2.

ListAppend('', 'elem1,elem2' )

elem1,elem2

List length is 2.

ListAppend
("one___two", "three", 
"___")

"one___two_three"

Inserted the first character of delimiters before "three."

 
Example
<h3>ListAppend Example</h3>
<!--- First, query to get some values for our list elements--->
<cfquery name = "GetParkInfo" datasource = "cfdocexamples">
SELECT PARKNAME,CITY,STATE
FROM PARKS WHERE PARKNAME LIKE `AL%'
</cfquery>
<cfset temp = ValueList(GetParkInfo.ParkName)>
<cfoutput>
<p>The original list: #temp#
</cfoutput>
<!--- now, append a park name to the list --->
<cfset temp2 = ListAppend(Temp, "ANOTHER PARK")>
...

A list or a variable that contains one.

LIST  

An element or a list of elements.

VALUE  

A string or a variable that contains one. Character(s) that separate list elements. The default value is comma.

If this parameter contains more than one character, ColdFusion uses only the first character.

DELIMITERS