Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added info on ignoring case for "contains" and "containsAll" methods #9811

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ You may also pass an array as the second argument. If the string ends with any o
<a name="method-str-contains"></a>
#### `Str::contains()` {.collection-method}

The `Str::contains` method determines if the given string contains the given value. This method is case sensitive:
The `Str::contains` method determines if the given string contains the given value. By default this method is case sensitive:

use Illuminate\Support\Str;

Expand All @@ -440,6 +440,14 @@ You may also pass an array of values to determine if the given string contains a

// true

You may disable case sensitivity by setting the `ignoreCase` argument to `true`:

use Illuminate\Support\Str;

$contains = Str::contains('This is my name', 'MY', ignoreCase: true);

// true

<a name="method-str-contains-all"></a>
#### `Str::containsAll()` {.collection-method}

Expand All @@ -451,6 +459,14 @@ The `Str::containsAll` method determines if the given string contains all of the

// true

You may disable case sensitivity by setting the `ignoreCase` argument to `true`:

use Illuminate\Support\Str;

$containsAll = Str::containsAll('This is my name', ['MY', 'NAME'], ignoreCase: true);

// true

<a name="method-ends-with"></a>
#### `Str::endsWith()` {.collection-method}

Expand Down Expand Up @@ -1686,7 +1702,7 @@ You may also pass an array. If the string ends with any of the values in the arr
<a name="method-fluent-str-contains"></a>
#### `contains` {.collection-method}

The `contains` method determines if the given string contains the given value. This method is case sensitive:
The `contains` method determines if the given string contains the given value. By default this method is case sensitive:

use Illuminate\Support\Str;

Expand All @@ -1702,6 +1718,14 @@ You may also pass an array of values to determine if the given string contains a

// true

You can disable case sensitivity by setting the `ignoreCase` argument to `true`:

use Illuminate\Support\Str;

$contains = Str::of('This is my name')->contains('MY', ignoreCase: true);

// true

<a name="method-fluent-str-contains-all"></a>
#### `containsAll` {.collection-method}

Expand All @@ -1713,6 +1737,14 @@ The `containsAll` method determines if the given string contains all of the valu

// true

You can disable case sensitivity by setting the `ignoreCase` argument to `true`:

use Illuminate\Support\Str;

$containsAll = Str::of('This is my name')->containsAll(['MY', 'NAME'], ignoreCase: true);

// true

<a name="method-fluent-str-dirname"></a>
#### `dirname` {.collection-method}

Expand Down