diff --git a/helpers.md b/helpers.md index 02872ba3b9..a97b3c5927 100644 --- a/helpers.md +++ b/helpers.md @@ -193,6 +193,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct [replaceLast](#method-fluent-str-replace-last) [replaceMatches](#method-fluent-str-replace-matches) [rtrim](#method-fluent-str-rtrim) +[scan](#method-fluent-str-scan) [singular](#method-fluent-str-singular) [slug](#method-fluent-str-slug) [snake](#method-fluent-str-snake) @@ -2443,6 +2444,17 @@ The `rtrim` method trims the right side of the given string: // '/Laravel' + +#### `scan` {.collection-method} + +The `scan` method parses input from a string into a collection according to a format supported by the [`sscanf` PHP function](https://www.php.net/manual/en/function.sscanf.php): + + use Illuminate\Support\Str; + + $collection = Str::of('filename.jpg')->scan('%[^.].%s'); + + // collect(['filename', 'jpg']) + #### `singular` {.collection-method}