Description

Gets a list, without its first element.

Returns

A copy of list, without the first element. If list has one element, returns an empty list.

Category

List functions

Function syntax

ListRest(list [, delimiters, includeEmptyValues ])

See also

ListFirstListGetAtListLastLists in Data types- Developing guide in the Developing ColdFusion Applications

Parameters

Parameter

Description

includeEmptyValues

Optional. Set to yes to include empty values.

list

A list or a variable that contains one.

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.

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.

Example

<cfscript>
    // case 1
    myList="Delhi,Mumbai,Bangalore,Chennai"
    rest=ListRest(myList)
    writeOutput(rest & "<br/>")
    // case 2- using delimiter
    myList1="Delhi;Mumbai:Bangalore,Chennai"
    rest1=ListRest(myList1,";:,")
    writeOutput(rest1)
</cfscript>

Output

Mumbai,Bangalore,Chennai
Mumbai:Bangalore,Chennai

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy