ArrayFindall()

Used to loop over the array, returning an array of indices of the elements where the function that was called returned true

Usage

ARRAY = ArrayFindall( array, function )
Argument Summary
array Array Object
function function to loop over the data, passing in the element as the parameter to each. each function call should return true or false; function(element){}

Calling

Supports named-parameter calling allowing you to use the function like:

ArrayFindall(
   array=?, 
   function=?
);

Supports passing parameters as a structure using ArgumentCollection:

ArrayFindall( ArgumentCollection={
   array : ?, 
   function : ?
} );

Extra

Creates an array of the indices where the callback function returned true. The callback function must return either true/false.

<cfscript>
// Create a sample array
arr = ["alan", "ceri", "andy", "jamie" ];


// Callback function declared that accepts the element
function arrayLoopCallback(el){
  if ( el.startsWith("a") )
    return true;
  else
    return false;
}


// Create a new array from the old one
newArr = ArrayFindAll( arr, arrayLoopCallback );

// newArr will be [1,2]
</cfscript>