StringMap()
Iterates over every entry of the string and calls the closure function to work on the element of the string.
Introduced: 6.0.0.105
StringMap( string=string, closure=function );
Returns: String
| Argument | Description |
|---|---|
|
string
string,
required
|
edit
Input string. Alias: inputString, object |
|
closure
function,
optional
|
edit
Closure or a function reference that will be called for each of the iteration. Alias: callback |
Usage Notes
editSince Lucee 6, this function iterates over each character in the string.
For list-based iteration with delimiters, use ListMap() instead.
Examples
edit myString="Hello World";
closure=function(val){
return (val & 'a')
}
writeDump(StringMap(myString,closure));
See also
- string.map()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)