ColdFusion: Using The listAppend() Function



<!--- Initialize a variable to use for our list items --->
<cfset someList="">

<!--- Let's add some list items to the currently empty list --->
<cfset someList = listAppend(someList, "Hello")>
<cfset someList = listAppend(someList, "World")>

<!--- Output the content of someList --->
<cfdump var="#someList#">

Result:
someList = "Hello,World"

Note:
By default ColdFusion adds a comma ( , ) as the list delimiter. If you like to replace the list delimiter with a different character, just set it as a third parameter:

<cfset someList = listAppend(someList, "Hello", "-")>

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s