byjg/convert

一种轻量级工具,用于在UTF8文本与多种格式之间进行字符串转换。

4.9.0 2022-06-15 13:17 UTC

This package is auto-updated.

Last update: 2024-09-12 02:36:29 UTC


README

Build Status Opensource ByJG GitHub source GitHub license GitHub release

一种轻量级工具,用于在UTF8文本与多种格式之间进行字符串转换。

示例

<?php
$str = \ByJG\Convert\ToUTF8::fromHtmlEntities('Jo&atilde;o');
echo $str; // João

$str2 = \ByJG\Convert\FromUTF8::toHtmlEntities('João');
echo $str2; // Jo&atilde;o

$str3 = \ByJG\Convert\FromUTF8::removeAccent('João');
echo $str3; // Joao

$str4 = \ByJG\Convert\FromUTF8::toIso88591Email('João');
echo $str4; // =?iso-8859-1?Q?Jo=E3o?=

$str5 = \ByJG\Convert\FromUTF8::onlyAscii('Joãoᅠ');
echo $str5; // Joao

// https://en.wikipedia.org/wiki/Combining_character
$str6 = \ByJG\Convert\ToUTF8::fromCombiningChar($combining);
echo $str6;

安装

只需输入

composer install "byjg/convert"

运行测试

vendor/bin/phpunit

依赖项

开源ByJG