Re: mbstring, a proposition of additional functions

From: Date: Mon, 24 Sep 2012 18:04:57 +0000
Subject: Re: mbstring, a proposition of additional functions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-63230@lists.php.net to get a copy of this message
On 24/09/12 15:41, Ivan Enderlin @ Hoa wrote:
Recently, I crafted a String object that support most of the propositions written here. Please, see https://github.com/hoaproject/String (file String.php). The code is very simple (it implies that it do not need a lot of work to implement it in PHP I hope). Some interesting methods:
    • append;
    • prepend;
    • pad;
    • getIterator (equivalent of str_split);
    • \ArrayAccess methods (with support of out-of-bound indexes);
    • getByteAt (with support of out-of-bound indexes);
    • getCharDirection;
    • fromCode;
    • toCode.
I would love such a library to be built into PHP. A more consistent approach to scalar operations would be great. "hello, world"->replace('world', 'php'); would be so much nicer than str_replace and forgetting the argument order. This is a little off-topic, though.
-- Andrew Faulds http://ajf.me/

« previous php.internals (#63230) next »