predictype / predicates/strings / stringSubstring
stringSubstring(
source
,oper
,target
):boolean
Defined in: predicates/strings/stringSubstring.ts:26
Checks if a string contains, excludes, starts with, or ends with a substring using the specified operation.
string
The string to check.
The substring operation to perform (e.g. ‘includes’, ‘starts_with’).
string
The substring to check for.
boolean
True if the substring check is valid according to the operator, otherwise false.
If the operation is not recognized.
const str = 'foobar';
stringSubstring(str, 'includes', sub); // true
stringSubstring(str, 'starts_with', sub); // true
Supported Operators: