Lucee Function Reference

stringreduce()

Iterates over every element of the string and calls the closure to work on the elements of the string. This function will reduce the string to a single value and will return the value.

Example

stringreduce(string string,function closure,[any initialVal]):any

Arguments

The arguments for this function are set. You can not use other arguments except the following ones.
Name Type Required Description
string string  Yes Input string.  
closure function  Yes Closure or a function reference that will be called for each of the iteration.  
initialVal any  No Initial value that will be used for the reduce operation.