CFLib.org – Common Function Library Project

Array([paramN])

Last updated July 03, 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson