This function iterates over every character in the string and executes the callback function to reduce the string to a single value.
stringReduce(string,callback,initialValue)
→ returns string
string.reduce(callback, initialValue)
arrayReduce()
.
Reduce the string to a single value.
letters="abcdef";
closure=function(inp1,inp2){return inp1 & inp2;}
writeOutput( StringReduce(letters,closure,"z") );
Expected Result: zabcdef
Reduce the string to a single value.
letters="abcdef";
closure=function(inp1,inp2){return inp1 & inp2;}
writeOutput( letters.reduce(closure,"z") );
Expected Result: zabcdef
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.