Description

Concatenates a list or element to a list.

Returns

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

Category

List functions

Function syntax

ListAppend(list, value [, delimiters ])

See also

ListPrependListInsertAtListGetAtListLastListSetAt; Lists in the Developing ColdFusion Applications

Parameters

Parameter

Description

list

A list or a variable that contains a list. 

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 uses only the first character.

Usage

ColdFusion inserts a delimiter character before value. The following table shows examples of ListAppend processing:

Statement

Output

Comment

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

<cfscript>
       myList="John,Paul,George,Ringo";
       myListAppended=ListAppend(myList,"George Martin",","); // Delimiter is comma
       WriteOutput(myListAppended);
</cfscript>

Output

John,Paul,George,Ringo,George Martin

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy