User Guide

Chapter 2: ColdFusion Functions 425
ListRest
Returns list without its first element. Returns an empty list (empty string) if list has
only one element.
See also ListFirst, ListGetAt, and ListLast.
Syntax ListRest(
list
[,
delimiters
])
list
List whose elements are being retrieved.
delimiters
Set of delimiters used in list.
Examples <!--- This example shows ListFirst, ListLast, and ListRest --->
<HTML>
<HEAD>
<TITLE>ListRest Example</TITLE>
</HEAD>
<BODY>
<H3>ListRest Example</H3>
<!--- Find a list of users who wrote messages --->
<CFQUERY NAME="GetMessageUser" DATASOURCE="cfsnippets">
SELECT Username, Subject, Posted
FROM Messages
</CFQUERY>
<CFSET temp = ValueList(GetMessageUser.Username)>
<!--- Show the first user in the list --->
<P>The first user in the list is <CFOUTPUT>#ListFirst(temp)#
</CFOUTPUT>.
<P>The rest of the users in the list is as follows:
<CFOUTPUT>#ListRest(temp)#</CFOUTPUT>.
<P>The last user in the list is <CFOUTPUT>#ListLast(temp)#</CFOUTPUT>
</BODY>
</HTML>