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=[any], virtual=[boolean])
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
false
parallel
boolean
false
false
maxThreads
any
false
virtual
boolean
false
false
Examples
Full function
Do all letters in the string meet the callback condition?
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
letters = "I love boxlang";
callbackFunction = ( Any input ) => {
return input == "e";
};
result = stringEvery( letters, callbackFunction );
writeDump( result );
result1 = stringEvery( "Eee", callbackFunction );
writeDump( result1 );
Related
Last updated
Was this helpful?