Skip to content

Update wrong example in strings.md #1

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

Merged
merged 1 commit into from
Jul 22, 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
8 changes: 4 additions & 4 deletions strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -1655,17 +1655,17 @@ The `chopEnd` method removes the last occurrence of the given value only if the

use Illuminate\Support\Str;

$url = Str::of('https://laravel.com')->chopEnd('https://');
$url = Str::of('https://laravel.com')->chopEnd('.com');

// 'laravel.com'
// 'https://laravel'

You may also pass an array. If the string ends with any of the values in the array then that value will be removed from string:

use Illuminate\Support\Str;

$url = Str::of('http://laravel.com')->chopEnd(['https://', 'http://']);
$url = Str::of('http://laravel.com')->chopEnd(['.com', '.io']);

// 'laravel.com'
// 'http://laravel'

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