palmtree / string
面向对象字符串操作库
v1.0.2
2023-09-26 11:31 UTC
Requires
- php: ^8.1
Requires (Dev)
- palmtree/php-cs-fixer-config: ^2.0
- phpunit/phpunit: ^10.3
- vimeo/psalm: ^5.2
This package is auto-updated.
Last update: 2024-08-26 13:26:19 UTC
README
面向对象字符串操作库
需求
- PHP >= 8.1
安装
使用 composer 将包添加到依赖中
composer require palmtree/string
使用方法
use function Palmtree\String\s; $str = s('foo bar baz'); $str->startsWith('foo'); // true $str->endsWith('baz'); // true $str->contains('bar'); // true $str->replace('bar', 'qux'); // 'foo qux baz' $str->after('bar'); // ' baz' $str->afterLast('b'); // 'az' $str->beforeFirst('b'); // 'foo ' $str->kebab(); // 'foo-bar-baz' $str->camel(); // 'fooBarBaz' $str->snake(); // 'foo_bar_baz'
提供了许多其他方法。阅读文档化的 源代码 了解更多。
许可
在 MIT 许可证 下发布