stringEach

Iterates over a string and runs the closure function for each element in the string.

stringEach(string,callback) → returns void

Member Function Syntax

string.each(callback)

stringEach Argument Reference

string string
Required

The input string.

callback any
Required

The closure function that is executed for each element in the string. The syntax is callback(element,index,string).

Compatibility

Lucee:

Version 6+ Lucee doesn't have a specific stringEach function yet, but their Each() function is similar, though deprecated.

Links more information about stringEach

Examples sample code invoking the stringEach function

letters="ahqwz";
callback=function(inp){ writeoutput(inp == "q");}
StringEach(letters,callback);

Expected Result: NONOYESNONO

letters="ahqwz";
letters.each(function(inp){writeoutput(inp == "q");});

Expected Result: NONOYESNONO


Fork me on GitHub