CFLib.org – Common Function Library Project

listRest2(orgList[, listDel])

Last updated January 03, 2007

author

Tom Kitta

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Same functionality as CF listRest but faster, for lists with 4000 elements about 1000 (no kidding, on CFMX 7.01) times faster. Stock listRest will crash your server with large lists when used multiple times, use listRest2 and be on the safe side.

Return Values:
returns a string.

Example:

<cfset huh = ListRest2("1,2,3,4,5")><!--- huh = 2,3,4,5 --->
<cfset huh = ListRest2("")><!--- huh = empty string --->
<cfset huh = ListRest2("1")><!--- huh = empty string --->

Parameters:

Name Description Required
orgList Original list. Yes
listDel List delimiter. Defaults to a comma. No

Full UDF Source:

/**
 * Same functionality as CF stock listRest but faster, at least on CFMX 7.01
 * 
 * @param orgList      Original list. (Required)
 * @param listDel      List delimiter. Defaults to a comma. (Optional)
 * @return returns a string. 
 * @author Tom Kitta (tom@tomkitta.com) 
 * @version 1, January 3, 2007 
 */
function ListRest2(orgList) {
    var listDel = ',';
    if(arrayLen(arguments) gte 2) listDel = arguments[2];
    if (len(orgList) gt 0) return listDeleteAt(orgList,1,listDel);
    return "";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson