hyqo / string
Fluent-style string operations
1.0.0
2023-02-21 16:55 UTC
Requires
- php: ^8.2
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Fluent-style string operations
Install
composer require hyqo/string
Usage
use function Hyqo\String\s; echo s('FOO BAR')->lower()->upperFirst(); //Foo bar
Other functions:
use function Hyqo\String\s; use Hyqo\String\SplitFlag; s('foo#bar')->leftCrop('#'); //bar s('foo#bar')->rightCrop('#'); //foo s('foo, , bar')->split(','); // ['foo', ' ', ' bar'] s('foo, , bar')->split(',', SplitFlag::TRIM | SplitFlag::NO_EMPTY); // ['foo', 'bar'] s('foo, , bar')->splitStrictly(','); // ['foo', 'bar']