| CFML Reference
|
|
ColdFusion Functions
|
ListRest
Description
Returns list without its first element. Returns an empty list (empty string) if list has only one element.
Category
List functions
Syntax
ListRest(list [, delimiters ])
See also
ListFirst, ListGetAt, ListLast
Parameters
| Parameter |
Description |
list
|
List whose elements to retrieve
|
delimiters
|
Set of delimiters used in list
|
Usage
|
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 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>
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|