Iterates over every entry of the List and calls the closure function to work on the item of the list. The returned value will be set at the same index in a new list and the new list will be returned.
listMap(list, function(item [,index, list]) [,delimiter, includeEmptyFields)
→ returns string
item
*
string
:
value
index
*
numeric
:
current index for the iteration
list
*
string
:
reference of the original list
,
false
Rainbow = "Whero, Karaka, Kowhai, Kakariki, Kikorangi, Tawatawa, Mawhero";
externalList = "";
reverseRainbow = listMap( rainbow, function(v,i,l) {
var newValue = "#i#:#v.reverse()#";
externalList = externalList.listAppend(newValue);
return newValue;
});
writeDump([{rainbow=rainbow},{reverseRainbow=reverseRainbow},{externalList=externalList}]);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.