Skip to content

Commit

Permalink
[8.x] Add scan fluent method to Stringable (laravel#7626)
Browse files Browse the repository at this point in the history
* [8.x] Add `scan` fluent method to Stringable

* Oops!

* Update helpers.md

Co-authored-by: Amir <a.rami@adaptech.me>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
3 people authored Jan 25, 2022
1 parent bc890b3 commit 4cb58a8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2443,6 +2444,17 @@ The `rtrim` method trims the right side of the given string:

// '/Laravel'

<a name="method-fluent-str-scan"></a>
#### `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'])

<a name="method-fluent-str-singular"></a>
#### `singular` {.collection-method}

Expand Down

0 comments on commit 4cb58a8

Please sign in to comment.