listRest
Description
Gets a list, without its first element.
Categories
Related
Syntax
ListRest(list [, delimiters, includeEmptyValues ])
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| 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 processes each occurrence of each character as a delimiter. | ||
| includeEmptyValues | Optional. Set to yes to include empty values. | ||
| list | A list or a variable that contains one. |
Returns
A copy
of list, without the first element. If list has one
element, returns an empty list.
Usage
If the list begins with one or more empty entries, this function drops them, as well as the first element.
ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
Example
<h3>ListFirst, ListLast, and ListRest Example</h3>
<!--- Find a list of users who wrote messages --->
<cfquery name = "GetMessageUser" datasource = "cfdocexamples">
SELECT Username, Subject, Posted
FROMMessages
</cfquery>
<cfset temp = ValueList(GetMessageUser.Username)>
Before editing the list, it is:
<cfoutput>#ValueList(GetMessageUser.Username)#</cfoutput>.
(Users who posted more than once are listed more than once.)
The first user in the list is:
<cfoutput>#ListFirst(temp)# </cfoutput>
The rest of the list is: <cfoutput>#ListRest(temp)#</cfoutput>.
(Users who posted more than once are listed more than once.)
The last user in the list is: <cfoutput>#ListLast(temp)#</cfoutput>