CFLib.org – Common Function Library Project

removeNullAndDangleDelimFromList(lst[, delim])

Last updated March 7, 2010

author

Bharat Patel

Version: 0 | Requires: CF5 | Library: StrLib

Description:
This is the simplest way to remove null element and dangle delimiter from the given list.

Return Values:
Returns a string.

Example:

<cfset List1 = '1,2,,CF,,Oracle,Sql,,7,'>
<cfoutput>
	#List1#<br />
	#removeNullAndDangleDelimFromList(List1,',')#	
</cfoutput>

Parameters:

Name Description Required
lst list to remove null elements and dangling delimiter Yes
delim list delimiter, defaults to comma "," No

Full UDF Source:

/**
 * Remove null element and dangel delimiter from the list
 * 
 * @param lst 	 list to remove null elements and dangling delimiter (Required)
 * @param delim 	 list delimiter, defaults to comma "," (Optional)
 * @return Returns a string. 
 * @author Bharat Patel (bharat@isummation.com) 
 * @version 0, March 7, 2010 
 */
function removeNullAndDangleDelimFromList(lst){
	var listDelim=",";
	if (arraylen(arguments) gt 1)
		listDelim=arguments[2];
	return ArrayToList(ListToArray(arguments.lst,listDelim));
}
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