StringMap
Iterates over all elements in a string and returns a new mapped string
Method Signature
StringMap(list=[string], callback=[function:Function], delimiter=[string], includeEmptyFields=[boolean], parallel=[boolean], maxThreads=[integer])
Arguments
Argument
Type
Required
Description
Default
list
string
true
callback
function:Function
true
The callback which returns a boolean and filters the string
delimiter
string
false
,
includeEmptyFields
boolean
false
false
parallel
boolean
false
false
maxThreads
integer
false
Examples
Full function
Map each element of the string to a new value.
letters = "abcdefg";
closure = ( Any inp ) => {
return char( ascii( inp ) + 7 );
};
writeOutput( StringMap( letters, closure ) );
Result: hijklmn
Member function
Map each element of the string to a new value.
letters = "abcdefg";
closure = ( Any inp ) => {
return char( ascii( inp ) + 7 );
};
writeOutput( letters.map( closure ) );
Result: hijklmn
Additional Examples
myString = "Hello World";
closure = ( Any val ) => {
return (val & "a");
};
writeDump( StringMap( myString, closure ) );
Related
Last updated
Was this helpful?