zonuexe / stringwidth
Measure string width (support Unicode east asian ambiguous width)
0.1.1
2015-03-22 18:57 UTC
Requires
- ext-mbstring: *
Requires (Dev)
- phploc/phploc: ~2.0.6
- phpmd/phpmd: @stable
- phpunit/phpunit: ~4.3.5
- satooshi/php-coveralls: dev-master
- theseer/phpdox: ~0.7.0
Suggests
- ext-intl: use \Locale class when $wcwidth function has not been instructed
This package is not auto-updated.
Last update: 2024-11-09 18:32:41 UTC
README
Measure string width (support Unicode east asian ambiguous width)
Install
composer require 'zonuexe/stringwidth:~0.1.1'
Usage
Notice: Input string must be UTF-8 encoded
<?php \Teto\StringWidth::asSingle('ABC'); //=> 3 \Teto\StringWidth::asDouble('ABC'); //=> 3 \Teto\StringWidth::asSingle('☆☆☆'); //=> 3 \Teto\StringWidth::asDouble('☆☆☆'); //=> 6 \Teto\StringWidth::asSingle('도서관'); //=> 6 \Teto\StringWidth::asDouble('도서관'); //=> 6
Copyright
src/StringWidth/Tanasinn/*.php
codes are derivatived by tanasinn/wcwidth.js at e432aeec63452e8c4d1e40e93f5f88f1bc729dca · saitoha/tanasinn. USAMI Kenta(@zonuexe) ported to PHP from JavaScript.
see src/StringWidth/Tanasinn/LICENSE
.
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is tanasinn
The Initial Developer of the Original Code is * Hayaki Saito.
Portions created by the Initial Developer are Copyright (C) 2010 - 2011
the Initial Developer. All Rights Reserved.
***** END LICENSE BLOCK *****
src/StringWidth.php
and test codes are licensed under Mozilla Public License, version 2.0
Copyright (c) 2015 USAMI Kenta
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.