shouding/mix-string

When unicode characters and ascii characters mixed, according to your needs, calculate the length of the string

1.0.0 2016-06-18 02:59 UTC

This package is not auto-updated.

Last update: 2024-04-22 11:12:02 UTC


README

Description

When unicode characters and ascii characters mixed, according to your needs, calculate the length of the string

Example

need composer

{
    "require": {
        "shouding/mix-string": "1.0.0"
    }
}
>>> require('vendor/autoload.php')
=> Composer\Autoload\ClassLoader {#162}
>>> use Shouding\Mix\Str;
=> null
>>> Str::length("this is a test 中国")
=> 6
>>> Str::length("this is a test 中国", Str::TYPE_CHAR)
=> 17
>>> Str::length("this is a test 中国", Str::TYPE_BYTES)
=> 21