StringFilter

Filters all the elements in a string according to a specified callback

Method Signature

StringFilter(list=[string], filter=[function:Predicate], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer])

Arguments

Argument
Type
Required
Description
Default

list

string

true

filter

function:Predicate

true

delimiter

string

false

,

includeEmptyFields

boolean

false

false

multiCharacterDelimiter

boolean

false

true

parallel

boolean

false

false

maxThreads

integer

false

Examples

Full function

Return only the letters in the string that meet the callback condition.

Run Example

letters = "zzQQZ";
callback = ( Any inp ) => {
	return inp == "z";
};
onlyZs = StringFilter( letters, callback );
writeOutput( onlyZs );

Result: zzZ

Member function

Return only the letters in the string that meet the callback condition.

letters = "zzQQZ";
callback = ( Any inp ) => {
	return inp == "z";
};
onlyZs = letters.filter( callback );
writeOutput( onlyZs );

Result: zzZ

Additional Examples

Run Example

letters = "abbcdB";
callbackFunction = ( Any input ) => {
	return input == "b";
};
result = stringFilter( letters, callbackFunction );
writeDump( result );
result1 = stringFilter( "bob", callbackFunction );
writeDump( result1 );

Last updated

Was this helpful?