ListNew()
Last updated January 12, 2004
Version: 1 | Requires: ColdFusion 5 | Library: StrLib
Description:
Converts the passed arguments array to a list and filters blanks. Helpful for creating lists from several values stored in different variables where some may be blank. Since it uses the arguments array as the source data for a list, there is no way to specify delimiters. To use custom delimiters use ListChangeDelims on the returned list.
Return Values:
Returns a list.
Example:
<cfparam name="form.var2" default="">
<cfparam name="form.var3" default="">
<cfset formValues = ListNew(form.var1, form.var2, form.var3)>
Parameters:
No arguments.
Full UDF Source:
<cfscript>
/**
* Creates a list from the passed arguments, skipping empty elements.
*
* @return Returns a list.
* @author Samuel Neff (sam@serndesign.com)
* @version 1, January 12, 2004
*/
function listNew() {
var arr = arrayNew(1);
var i = 1;
for(;i lte arrayLen(arguments);i=i+1) {
if(arguments[i] neq "") arr[arrayLen(arr)+1] = arguments[i];
}
return arrayToList(arr);
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
3 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)