stringMap

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

stringMap(string,callback) → returns string

Member Function Syntax

string.map(callback)

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

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub