StringEvery

Tests a string that all elements meet the specified criteria

Method Signature

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

Arguments

Argument
Type
Required
Description
Default

list

string

true

callback

function:Predicate

true

The callback to use for the test

delimiter

string

false

,

includeEmptyFields

boolean

false

false

multiCharacterDelimiter

boolean

false

true

parallel

boolean

false

false

maxThreads

integer

false

Examples

Full function

Do all letters in the string meet the callback condition?

Run Example

letters = "ZZazz";
callback = ( Any inp ) => {
	return inp == "z";
};
allZs = StringEvery( letters, callback );
writeOutput( allZs );

Result: NO

Member function

Do all letters in the string meet the callback condition?

letters = "zzZZz";
callback = ( Any inp ) => {
	return inp == "z";
};
allZs = letters.every( callback );
writeOutput( allZs );

Result: YES

Additional Examples

Run Example

letters = "I love boxlang";
callbackFunction = ( Any input ) => {
	return input == "e";
};
result = stringEvery( letters, callbackFunction );
writeDump( result );
result1 = stringEvery( "Eee", callbackFunction );
writeDump( result1 );

Last updated

Was this helpful?