November 25th, 2014

scotto monkeypulse

My tweets

Collapse )
scotto monkeypulse

cf method to merge a list and array

Pretty self explanatory:

/**
* mergeListToArray
* When provided a list and an array, we convert the list to an array and merge them.
* @param {Array} a Array to merge list to {required}
* @param {String} l List to merge with array {required}
* @param {String} delim Delimiters to use default = ','
* @return {Array}
*/
public Array function mergeListToArray(required array a,required string l,required string delim=','){
var tmpArr = ListToArray(trim(arguments.l),delim);
var newArr = arguments.a;
if(IsArray(newArr) && IsArray(tmpArr)){
// loop over current array and append to new array
for(i=1; i LTE ArrayLen(tmpArr); i=(i+1)){
ArrayAppend(newArr,tmpArr[i]);
}//end loop
}//end isarray
return newArr;
};

Originally published at The Scotto Grotto. You can comment here or there.