CFLib.org – Common Function Library Project

listRest2(orgList[, listDel])

Last updated January 3, 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 "";
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson