Skip to content

[12.x] Add doesntEndWith() & doesntStartWith() methods to Strings #10567

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

Closed
wants to merge 2 commits into from
Closed
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: 36 additions & 0 deletions strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Laravel includes a variety of functions for manipulating string values. Many of
[Str::contains](#method-str-contains)
[Str::containsAll](#method-str-contains-all)
[Str::doesntContain](#method-str-doesnt-contain)
[Str::doesntEndWith](#method-str-doesnt-end-with)
[Str::doesntStartWith](#method-str-doesnt-start-with)
[Str::deduplicate](#method-deduplicate)
[Str::endsWith](#method-ends-with)
[Str::excerpt](#method-excerpt)
Expand Down Expand Up @@ -558,6 +560,40 @@ $doesntContain = Str::doesntContain('This is name', 'MY', ignoreCase: true);
// true
```

<a name="method-str-doesnt-end-with"></a>
#### `Str::doesntEndWith()` {.collection-method}

The `Str::doesntEndWith` method determine if a given string doesn't start with a given substring:

```php
use Illuminate\Support\Str;

$doesntEndWith = Str::doesntEndWith('a7', 'a');

// true

$doesntEndWith = Str::doesntEndWith('a7', '7');

// false
```

<a name="method-str-doesnt-start-with"></a>
#### `Str::doesntStartWith()` {.collection-method}

The `Str::doesntStartWith` method determine if a given string doesn't end with a given substring:

```php
use Illuminate\Support\Str;

$doesntStartWith = Str::doesntStartWith('This is name', 'day');

// true

$doesntStartWith = Str::doesntStartWith('This is name', 'This');

// false
```

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

Expand Down