Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62072 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81948 invoked from network); 6 Aug 2012 19:54:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2012 19:54:42 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:35656] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/85-03102-FF020205 for ; Mon, 06 Aug 2012 15:54:40 -0400 Received: from Hwhost2.local (3-35.78-83.cust.bluewin.ch [83.78.35.3]) by host1.trois-doubles.net (Postfix) with ESMTPA id 183C920677B for ; Mon, 6 Aug 2012 21:54:36 +0200 (CEST) Message-ID: <502020FB.7010502@hoa-project.net> Date: Mon, 06 Aug 2012 21:54:35 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/16.0 Thunderbird/16.0a2 MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: mbstring, a proposition of additional functions From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hello, ext/mbstring is very useful, but from my point of view, some functions=20 are missing. I would like to propose the addition of the following functions. mb_append($str, $piece) and mb_prepend($str, $piece): To add a $piece to, respectively, the end and the start of $string. It=20 should consider the text direction, e.g. if $str is Right-to-Left,=20 mb_append() will add $piece to the end, so the left, of $string. concat($str, $piece): If mb_append() and mb_prepend() are too hard to understand by users,=20 concat() would be pretty much simpler and will act in the same way. mb_pad($length, $piece, $end): Pretty much like strpad but with multi-bytes considering. Note that, like mb_append and mb_prepend, we do not speak about left and = right, but start and end. mb_get_direction($str): Return LTR or RTL. For one char, it is =93easy=94. For a string, it is mo= re=20 complex because we can have embedding directions (a string with many=20 directions). mb_get_char($code) or mb_chr($code): Get Unicode character from a code-point/decimal value representation. mb_get_code($char) or mb_ord($char): Get code-point/decimal value representation from of Unicode character. Finally, it would be great if mb_substr() could consider text direction=20 (or create a new dedicated function?). For example, mb_substr($str, 0,=20 1) will return the first char from the start (and not the left as it is=20 implemented now). I think it could help developers to create nice libraries without=20 requiring a lot of skills in Unicode. Thoughts? Best regards :-). --=20 Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/