@@ -143,8 +143,8 @@ Laravel includes a variety of functions for manipulating string values. Many of
143
143
[ containsAll] ( #method-fluent-str-contains-all )
144
144
[ dirname] ( #method-fluent-str-dirname )
145
145
[ endsWith] ( #method-fluent-str-ends-with )
146
- [ excerpt] ( #method-fluent-str-excerpt )
147
146
[ exactly] ( #method-fluent-str-exactly )
147
+ [ excerpt] ( #method-fluent-str-excerpt )
148
148
[ explode] ( #method-fluent-str-explode )
149
149
[ finish] ( #method-fluent-str-finish )
150
150
[ headline] ( #method-fluent-str-headline )
@@ -1763,32 +1763,6 @@ If necessary, you may specify how many directory levels you wish to trim from th
1763
1763
1764
1764
// '/foo'
1765
1765
1766
- <a name =" method-fluent-str-excerpt " ></a >
1767
- #### ` excerpt ` {.collection-method}
1768
-
1769
- The ` excerpt ` method extracts an excerpt from the string that matches the first instance of a phrase within that string:
1770
-
1771
- use Illuminate\Support\Str;
1772
-
1773
- $excerpt = Str::of('This is my name')->excerpt('my', [
1774
- 'radius' => 3
1775
- ]);
1776
-
1777
- // '...is my na...'
1778
-
1779
- The ` radius ` option, which defaults to ` 100 ` , allows you to define the number of characters that should appear on each side of the truncated string.
1780
-
1781
- In addition, you may use the ` omission ` option to change the string that will be prepended and appended to the truncated string:
1782
-
1783
- use Illuminate\Support\Str;
1784
-
1785
- $excerpt = Str::of('This is my name')->excerpt('name', [
1786
- 'radius' => 3,
1787
- 'omission' => '(...) '
1788
- ]);
1789
-
1790
- // '(...) my name'
1791
-
1792
1766
<a name =" method-fluent-str-ends-with " ></a >
1793
1767
#### ` endsWith ` {.collection-method}
1794
1768
@@ -1823,6 +1797,32 @@ The `exactly` method determines if the given string is an exact match with anoth
1823
1797
1824
1798
// true
1825
1799
1800
+ <a name =" method-fluent-str-excerpt " ></a >
1801
+ #### ` excerpt ` {.collection-method}
1802
+
1803
+ The ` excerpt ` method extracts an excerpt from the string that matches the first instance of a phrase within that string:
1804
+
1805
+ use Illuminate\Support\Str;
1806
+
1807
+ $excerpt = Str::of('This is my name')->excerpt('my', [
1808
+ 'radius' => 3
1809
+ ]);
1810
+
1811
+ // '...is my na...'
1812
+
1813
+ The ` radius ` option, which defaults to ` 100 ` , allows you to define the number of characters that should appear on each side of the truncated string.
1814
+
1815
+ In addition, you may use the ` omission ` option to change the string that will be prepended and appended to the truncated string:
1816
+
1817
+ use Illuminate\Support\Str;
1818
+
1819
+ $excerpt = Str::of('This is my name')->excerpt('name', [
1820
+ 'radius' => 3,
1821
+ 'omission' => '(...) '
1822
+ ]);
1823
+
1824
+ // '(...) my name'
1825
+
1826
1826
<a name =" method-fluent-str-explode " ></a >
1827
1827
#### ` explode ` {.collection-method}
1828
1828
0 commit comments