StringReduce
Run the provided udf over all characters in a string to reduce the values to a single output
Method Signature
StringReduce(list=[string], callback=[function:BiFunction], initialValue=[any], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
Arguments
Argument
Type
Required
Description
Default
list
string
true
callback
function:BiFunction
true
The callback to use for the test
initialValue
any
false
The initial value of the reduction
delimiter
string
false
,
includeEmptyFields
boolean
false
false
multiCharacterDelimiter
boolean
false
true
Examples
Full function
Reduce the string to a single value.
letters = "abcdef";
closure = ( Any inp1, Any inp2 ) => {
return inp1 & inp2;
};
writeOutput( StringReduce( letters, closure, "z" ) );
Result: zabcdef
Member function
Reduce the string to a single value.
letters = "abcdef";
closure = ( Any inp1, Any inp2 ) => {
return inp1 & inp2;
};
writeOutput( letters.reduce( closure, "z" ) );
Result: zabcdef
Additional Examples
letters = "abcdef";
closure = ( Any value1, Any value2 ) => {
return value1 & value2;
};
writeOutput( stringReduce( letters, closure, "z" ) );
Related
Last updated
Was this helpful?