stringMap

This functions executes the callback function for each element in the string.

stringMap(string,callback) → returns string

Member Function Syntax

string.map(callback)

stringMap Argument Reference

string string
Required

Original input string.

callback any

The closure function that is executed for each element in the string.

Compatibility

Lucee:

Version 6+ This function is being added in Lucee 6. It is similar to other map functions, like arrayMap().

Links more information about stringMap

Examples sample code invoking the stringMap function

Map each element of the string to a new value.

letters="abcdefg";
closure=function(inp){return chr(asc(inp)+7);}
writeOutput(StringMap(letters,closure));

Expected Result: hijklmn

Map each element of the string to a new value.

letters="abcdefg";
closure=function(inp){return chr(asc(inp)+7);}
writeOutput(letters.map(closure));

Expected Result: hijklmn


Fork me on GitHub