Alphabetical List of ColdFusion Functions
ListAppend
Description
Returns list with value appended to its last element.
Category
List functions
ListAppend(list, value [, delimiters ])
Syntax
See also
ListPrepend, ListInsertAt,
Parameters
Parameter
list
value
delimiters
Usage
When appending an element into a list, ColdFusion inserts a delimiter. If delimiters
contains more than one delimiter, ColdFusion defaults to the first delimiter in the
string, or a comma, if delimiters was omitted.
If you intend to use list functions on strings that are delimited by the conjunction ", "
(comma-space), as is common in HTTP header strings such as the COOKIE header,
we recommend that you specify delimiters to include both comma and space,
because ColdFusion Server does not skip white space. For example,
ListAppend(List, "MyCookie", "," & CHR(32))
Note
ColdFusion ignores empty list elements; thus, a list that is defined as "a,b,c,,,d" is
treated as a four element list.
Example
<!--- This example shows ListAppend --->
<html>
<head>
<title>ListAppend Example</title>
</head>
<body>
<H3>ListAppend Example</H3>
<!--- First, query to get some values for our list --->
<cfquery name = "GetParkInfo" datasource = "cfsnippets">
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", ",")>
...
ListSetAt
Description
A list
Number or list to append
Set of delimiters used in list
485
Need help?
Do you have a question about the COLDFUSION 5 - CFML and is the answer not in the manual?