Whatever message this page gives is out now! Go check it out!
StringReduce(String string, UDFMethod callback, Object initialValue)Parameter | Description |
string | (Required) The input string |
callback | (Required) Closure or a function reference that will be called for each of the iteration. |
initialVal | (Optional) Initial value that will be used for the reduce operation. The type is any. |
<cfscript>
myStr="2021";
closure=function(value1,value2){
return (value1 & value2);
}
writeOutput(StringReduce(myStr,closure,"ColdFusion"))
//writeOutput(myStr.reduce(closure,"ColdFusion"))
</cfscript><cfscript>
closure=function(value1,value2){
return (value1&value2);
}
writeOutput(StringReduce(callback=closure,initialValue="Hello",string="World"))
</cfscript>