contains
优质
小牛编辑
136浏览
2023-12-01
Checks if this sequence contains a given substring.
Signature
StringLikeSequence.contains = function(substring) { /*...*/ }
StringLikeSequence.contains = function contains(substring) { return this.indexOf(substring) !== -1; }
Name | Type(s) | Description |
---|---|---|
substring | string | The substring to check for. |
returns | boolean | Whether or not this sequence contains |
Examples
Lazy('hello').contains('ell') // => true Lazy('hello').contains('') // => true Lazy('hello').contains('abc') // => false