@@ -48,6 +48,8 @@ Laravel includes a variety of functions for manipulating string values. Many of
48
48
[ Str::contains] ( #method-str-contains )
49
49
[ Str::containsAll] ( #method-str-contains-all )
50
50
[ Str::doesntContain] ( #method-str-doesnt-contain )
51
+ [ Str::doesntEndWith] ( #method-str-doesnt-end-with )
52
+ [ Str::doesntStartWith] ( #method-str-doesnt-start-with )
51
53
[ Str::deduplicate] ( #method-deduplicate )
52
54
[ Str::endsWith] ( #method-ends-with )
53
55
[ Str::excerpt] ( #method-excerpt )
@@ -149,6 +151,8 @@ Laravel includes a variety of functions for manipulating string values. Many of
149
151
[ decrypt] ( #method-fluent-str-decrypt )
150
152
[ deduplicate] ( #method-fluent-str-deduplicate )
151
153
[ dirname] ( #method-fluent-str-dirname )
154
+ [ doesntEndWith] ( #method-fluent-str-doesnt-end-with )
155
+ [ doesntStartWith] ( #method-fluent-str-doesnt-start-with )
152
156
[ encrypt] ( #method-fluent-str-encrypt )
153
157
[ endsWith] ( #method-fluent-str-ends-with )
154
158
[ exactly] ( #method-fluent-str-exactly )
@@ -225,6 +229,8 @@ Laravel includes a variety of functions for manipulating string values. Many of
225
229
[ when] ( #method-fluent-str-when )
226
230
[ whenContains] ( #method-fluent-str-when-contains )
227
231
[ whenContainsAll] ( #method-fluent-str-when-contains-all )
232
+ [ whenDoesntEndWith] ( #method-fluent-str-when-doesnt-end-with )
233
+ [ whenDoesntStartWith] ( #method-fluent-str-when-doesnt-start-with )
228
234
[ whenEmpty] ( #method-fluent-str-when-empty )
229
235
[ whenNotEmpty] ( #method-fluent-str-when-not-empty )
230
236
[ whenStartsWith] ( #method-fluent-str-when-starts-with )
@@ -581,6 +587,54 @@ $result = Str::deduplicate('The---Laravel---Framework', '-');
581
587
// The-Laravel-Framework
582
588
```
583
589
590
+ <a name =" method-doesnt-end-with " ></a >
591
+ #### ` Str::doesntEndWith() ` {.collection-method}
592
+
593
+ The ` Str::doesntEndWith ` method determines if the given string doesn't end with the given value:
594
+
595
+ ``` php
596
+ use Illuminate\Support\Str;
597
+
598
+ $result = Str::doesntEndWith('This is my name', 'dog');
599
+
600
+ // true
601
+ ```
602
+
603
+ You may also pass an array of values to determine if the given string doesn't end with any of the values in the array:
604
+
605
+ ``` php
606
+ use Illuminate\Support\Str;
607
+
608
+ $result = Str::doesntEndWith('This is my name', ['this', 'foo']);
609
+
610
+ // true
611
+
612
+ $result = Str::doesntEndWith('This is my name', ['name', 'foo']);
613
+
614
+ // false
615
+ ```
616
+
617
+ <a name =" method-doesnt-start-with " ></a >
618
+ #### ` Str::doesntStartWith() ` {.collection-method}
619
+
620
+ The ` Str::doesntStartWith ` method determines if the given string doesn't begin with the given value:
621
+
622
+ ``` php
623
+ use Illuminate\Support\Str;
624
+
625
+ $result = Str::doesntStartWith('This is my name', 'That');
626
+
627
+ // true
628
+ ```
629
+
630
+ If an array of possible values is passed, the ` doesntStartWith ` method will return ` true ` if the string doesn't begin with any of the given values:
631
+
632
+ ``` php
633
+ $result = Str::doesntStartWith('This is my name', ['This', 'That', 'There']);
634
+
635
+ // true
636
+ ```
637
+
584
638
<a name =" method-ends-with " ></a >
585
639
#### ` Str::endsWith() ` {.collection-method}
586
640
@@ -2218,6 +2272,56 @@ $string = Str::of('/foo/bar/baz')->dirname(2);
2218
2272
// '/foo'
2219
2273
```
2220
2274
2275
+ <a name =" method-fluent-str-doesnt-end-with " ></a >
2276
+ #### ` doesntEndWith ` {.collection-method}
2277
+
2278
+ The ` doesntEndWith ` method determines if the given string doesn't end with the given value:
2279
+
2280
+ ``` php
2281
+ use Illuminate\Support\Str;
2282
+
2283
+ $result = Str::of('This is my name')->doesntEndWith('dog');
2284
+
2285
+ // true
2286
+ ```
2287
+
2288
+ You may also pass an array of values to determine if the given string doesn't end with any of the values in the array:
2289
+
2290
+ ``` php
2291
+ use Illuminate\Support\Str;
2292
+
2293
+ $result = Str::of('This is my name')->doesntEndWith(['this', 'foo']);
2294
+
2295
+ // true
2296
+
2297
+ $result = Str::of('This is my name')->doesntEndWith(['name', 'foo']);
2298
+
2299
+ // false
2300
+ ```
2301
+
2302
+ <a name =" method-fluent-str-doesnt-start-with " ></a >
2303
+ #### ` doesntStartWith ` {.collection-method}
2304
+
2305
+ The ` doesntStartWith ` method determines if the given string doesn't begin with the given value:
2306
+
2307
+ ``` php
2308
+ use Illuminate\Support\Str;
2309
+
2310
+ $result = Str::of('This is my name')->doesntStartWith('That');
2311
+
2312
+ // true
2313
+ ```
2314
+
2315
+ You may also pass an array of values to determine if the given string doesn't start with any of the values in the array:
2316
+
2317
+ ``` php
2318
+ use Illuminate\Support\Str;
2319
+
2320
+ $result = Str::of('This is my name')->doesntStartWith(['This', 'That', 'There']);
2321
+
2322
+ // true
2323
+ ```
2324
+
2221
2325
<a name =" method-fluent-str-encrypt " ></a >
2222
2326
#### ` encrypt ` {.collection-method}
2223
2327
@@ -3519,6 +3623,38 @@ $string = Str::of('tony stark')
3519
3623
3520
3624
If necessary, you may pass another closure as the third parameter to the ` when ` method. This closure will execute if the condition parameter evaluates to ` false ` .
3521
3625
3626
+ <a name =" method-fluent-str-when-doesnt-end-with " ></a >
3627
+ #### ` whenDoesntEndWith ` {.collection-method}
3628
+
3629
+ The ` whenDoesntEndWith ` method invokes the given closure if the string doesn't end with the given sub-string. The closure will receive the fluent string instance:
3630
+
3631
+ ``` php
3632
+ use Illuminate\Support\Str;
3633
+ use Illuminate\Support\Stringable;
3634
+
3635
+ $string = Str::of('disney world')->whenDoesntEndWith('land', function (Stringable $string) {
3636
+ return $string->title();
3637
+ });
3638
+
3639
+ // 'Disney World'
3640
+ ```
3641
+
3642
+ <a name =" method-fluent-str-when-doesnt-start-with " ></a >
3643
+ #### ` whenDoesntStartWith ` {.collection-method}
3644
+
3645
+ The ` whenDoesntStartWith ` method invokes the given closure if the string doesn't start with the given sub-string. The closure will receive the fluent string instance:
3646
+
3647
+ ``` php
3648
+ use Illuminate\Support\Str;
3649
+ use Illuminate\Support\Stringable;
3650
+
3651
+ $string = Str::of('disney world')->whenDoesntStartWith('sea', function (Stringable $string) {
3652
+ return $string->title();
3653
+ });
3654
+
3655
+ // 'Disney World'
3656
+ ```
3657
+
3522
3658
<a name =" method-fluent-str-when-empty " ></a >
3523
3659
#### ` whenEmpty ` {.collection-method}
3524
3660
0 commit comments