piyo2/str
最新稳定版本:v1.0.0
Composer 安装命令:
composer require piyo2/str
包简介
Normalizing/filtering string
README 文档
README
Normalizing/filtering string.
Features
- Remove control characters (except for tabs or newlines)
- Normalize Unicode composition sequences
- But keep CJK compatibility ideographs
- Block invalid/overlong UTF-8 sequences
- Transform functions:
- Uppercase <=> lowercase
- Zenkaku <=> Hankaku
- Hiragana <=> Katakana (including ゕ ゖ ゝ ゞ)
Requirements
- PHP ≥ 7.1.0
- Intl PHP Extension
- Mbstring PHP Extension
Example
$filter = (new Str())->trim() ->noNewlines() ->hankakuDigits() ->hiragana(); $filter->applyTo(" A03 \nアイス\n"); // => "A03 アイス"
Applying user-defined filter:
(new Str())->trim() ->hankaku() ->fn(fn ($s) => '#' . $s) ->applyTo(' 123'); // => "#123"
Retain control characters:
(new Str())->applyTo("\0\n"); // => "\n" (new Str(true))->applyTo("\0\n"); // => "\0\n"
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-27