This functions executes the callback function for each element in the string.
stringMap(string,callback)
returns string
string.map(callback)
Name | Type | Required | Default | Description |
---|---|---|---|---|
string | string | Yes | Original input string. | |
callback | any | No | The closure function that is executed for each element in the string. |
Map each element of the string to a new value.
letters="abcdefg";
closure=function(inp){return chr(asc(inp)+7);}
writeOutput(StringMap(letters,closure));
Map each element of the string to a new value.
letters="abcdefg";
closure=function(inp){return chr(asc(inp)+7);}
writeOutput(letters.map(closure));