containsAny
Checks if a string contains any of the given substrings.
containsAny
Signature
typescript
function containsAny(str: string, searches: string[], caseSensitive?: boolean): booleanParameters
str- The string to search insearches- Array of substrings to search forcaseSensitive- Whether to perform case-sensitive search (default:true)
Returns
true if any substring is found, false otherwise.
Examples
typescript
import { containsAny } from 'strio'
containsAny('hello world', ['hello', 'foo'])
// true
containsAny('hello world', ['foo', 'bar'])
// false
containsAny('Hello World', ['hello', 'world'], false)
// trueRelated Functions
- contains - Check if contains substring
- containsAll - Check if contains all substrings