CFLib.org – Common Function Library Project

Array([paramN])

Last updated July 3, 2002

author

Erki Esken

Version: 1 | Requires: CF5 | Library: DataManipulationLib

Description:
Now you can make simple or complex arrays with a one-liner in CF, just like with built-in shorthand syntax in many other programming languages. You can create simple 1D arrays with ease, or nest Array() functions to create complex 2D, 3D etc arrays.

Return Values:
Returns an array.

Example:

<cfdump var="#Array('one','two','three',Array('foo','bar','quux'))#">

Parameters:

Name Description Required
paramN This UDF accepts N optional arguments. Each argument is added to the returned array. No

Full UDF Source:

/**
 * This functions helps to quickly build arrays, both simple and complex.
 * 
 * @param paramN 	 This UDF accepts N optional arguments. Each argument is added to the returned array. (Optional)
 * @return Returns an array. 
 * @author Erki Esken (erki@dreamdrummer.com) 
 * @version 1, July 3, 2002 
 */
function Array() {
	var result = ArrayNew(1);
	var to = ArrayLen(arguments);
	var i = 0;
	for (i=1; i LTE to; i=i+1)
		result[i] = Duplicate(arguments[i]);
	return result;
}
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