CFLib.org – Common Function Library Project

ListRestRight(orgList[, listDel])

Last updated December 6, 2009

author

Antoine Gattolliat

Version: 1 | Requires: | Library: StrLib

Description:
Same functionality as CF ListRest starting from right instead of left. Based on Tom Kitta's ListRest2 that works faster than CF ListRest.

Return Values:
Returns a string.

Example:

<cfset foo = ListRestRight("1,2,3,4,5")><!--- foo = 1,2,3,4 --->
<cfset foo = ListRestRight("")><!--- foo = empty string --->
<cfset foo = ListRestRight("1")><!--- foo = 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 ListRest starting from right instead of left.
 * 
 * @param orgList 	 Original list. (Required)
 * @param listDel 	 List delimiter. Defaults to a comma. (Optional)
 * @return Returns a string. 
 * @author Antoine Gattolliat (antoine@igloo.be) 
 * @version 1, December 6, 2009 
 */
function ListRestRight(orgList) {
	var listDel = ',';
	if(arrayLen(arguments) gte 2) listDel = arguments[2];
	if (len(orgList) gt 0) return listDeleteAt(orgList,ListLen(orgList,listDel),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