@@ -78,7 +78,9 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
78
78
[ e] ( #method-e )
79
79
[ preg_replace_array] ( #method-preg-replace-array )
80
80
[ Str::after] ( #method-str-after )
81
+ [ Str::afterLast] ( #method-str-after-last )
81
82
[ Str::before] ( #method-str-before )
83
+ [ Str::beforeLast] ( #method-str-before-last )
82
84
[ Str::camel] ( #method-camel-case )
83
85
[ Str::contains] ( #method-str-contains )
84
86
[ Str::containsAll] ( #method-str-contains-all )
@@ -828,6 +830,17 @@ The `Str::after` method returns everything after the given value in a string:
828
830
829
831
// ' my name'
830
832
833
+ <a name =" method-str-after-last " ></a >
834
+ #### ` Str::afterLast() ` {#collection-method}
835
+
836
+ The ` Str::afterLast ` method returns everything after the last occurrence of the given value in a string:
837
+
838
+ use Illuminate\Support\Str;
839
+
840
+ $slice = Str::afterLast('App\Http\Controllers\Controller', '\\');
841
+
842
+ // 'Controller'
843
+
831
844
<a name =" method-str-before " ></a >
832
845
#### ` Str::before() ` {#collection-method}
833
846
@@ -839,6 +852,17 @@ The `Str::before` method returns everything before the given value in a string:
839
852
840
853
// 'This is '
841
854
855
+ <a name =" method-str-before-last " ></a >
856
+ #### ` Str::beforeLast() ` {#collection-method}
857
+
858
+ The ` Str::beforeLast ` method returns everything before the last occurrence of the given value in a string:
859
+
860
+ use Illuminate\Support\Str;
861
+
862
+ $slice = Str::beforeLast('This is my name', 'is');
863
+
864
+ // 'This '
865
+
842
866
<a name =" method-camel-case " ></a >
843
867
#### ` Str::camel() ` {#collection-method}
844
868
0 commit comments