这是一个轻量级的PHP字符串操作库

v1.0.1 2021-11-16 05:37 UTC

This package is auto-updated.

Last update: 2024-09-16 11:57:54 UTC


README

这是一个简单且轻量级的字符串操作库

这是一个持续开发的项目,经常添加新功能

使用composer安装

composer require abdellahramadan/string
use AbdellahRamadan\String\Strings;

压扁一段文本

$text = Strings::slug("this is a simple slug");

echo $text; // this-is-a-simple-slug

将文本转换为小写

$text = Strings::lowercase("I will be MADE A LOWERCASE");

echo $text; // i will be made a lowercase

搜索一个单词

$sentence = "I want to find a word";

Strings::contains($sentence, "find"); // true

添加前缀

$text = "is a cool language";

echo $completeText = Strings::prefix($text, "PHP"); // PHP is a cool language

还有更多...

正在添加更多字符串操作

测试

测试文件在测试目录中,可以用以下命令运行

vendor/bin/phpunit

贡献

欢迎贡献 😃

许可

MIT许可