diff --git a/strings.md b/strings.md index c19c9f675f..a87b73b5aa 100644 --- a/strings.md +++ b/strings.md @@ -2296,6 +2296,39 @@ $string = Str::of('/foo/bar/baz')->dirname(2); // '/foo' ``` + +#### `Str::doesntContain()` {.collection-method} + +The `Str::doesntContain` method determines if the given string does not contain the given value. This method is the inverse of the `contains` method. By default, this method is case sensitive: + +```php +use Illuminate\Support\Str; + +$doesntContain = Str::of('This is my name')->doesntContain('my'); + +// false +``` + +You may also pass an array of values to determine if the given string does not contain any of the values in the array: + +```php +use Illuminate\Support\Str; + +$doesntContain = Str::of('This is my name')->doesntContain(['my', 'foo']); + +// false +``` + +You may disable case sensitivity by setting the ignoreCase argument to true: + +```php +use Illuminate\Support\Str; + +$doesntContain = Str::of('This is my name')->doesntContain('MY', ignoreCase: true); + +// false +``` + #### `doesntEndWith` {.collection-method}