PHP code example of boomdraw / laravel-str
1. Go to this page and download the library: Download boomdraw/laravel-str library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
boomdraw / laravel-str example snippets
// bootstrap/app.php:
$app->register(Boomdraw\Str\StrServiceProvider::class);
use Illuminate\Support\Str;
Str::between(string $string, string $start, string $end, bool $strict = true);
Str::between('foo bar baz', 'foo ', ' baz') === 'bar';
Str::between('foo bar baz', 'test ', ' test') === false;
Str::between('foo bar baz', 'foo ', ' test') === false;
Str::between('foo bar baz', 'test ', ' baz') === false;
Str::between('foo bar baz', 'test ', ' test', false) === 'foo bar baz';
Str::between('foo bar baz', 'test ', ' baz', false) === 'foo bar';
Str::between('foo bar baz', 'foo ', ' test', false) === 'bar baz';
Str::wbetween(string $string, string $start, string $end, bool $strict = true);
Str::wbetween('goo foo bar baz haz', 'foo ', ' baz') === 'foo bar baz';
Str::wbetween('goo foo bar baz haz', 'test ', ' test') === false;
Str::wbetween('goo foo bar baz haz', 'foo ', ' test') === false;
Str::wbetween('goo foo bar baz haz', 'test ', ' baz') === false;
Str::wbetween('goo foo bar baz haz', 'test ', ' test', false) === 'goo foo bar baz haz';
Str::wbetween('goo foo bar baz haz', 'test ', ' baz', false) === 'goo foo bar baz';
Str::wbetween('goo foo bar baz haz', 'foo ', ' test', false) === 'foo bar baz haz';
Str::utrim(string $string): string;
Str::utrim("\hello world \n") === 'hello world';