note 69692 added to function.ucwords

From: Date: Fri, 15 Sep 2006 14:35:40 +0000
Subject: note 69692 added to function.ucwords
Groups: php.notes 
Request: Send a blank email to php-notes+get-117228@lists.php.net to get a copy of this message
I have rewritten a UCSMART function adding a feature to translate special ASCII char (windows occidental ascii charset): You can edit/add/delete char by use the first two string (be carefull to preserve the order of the string). Enjoy! <? $ASCII_SPC_MIN = "àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿžš"; $ASCII_SPC_MAX = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝŸŽŠ"; function str2upper($text) { global $ASCII_SPC_MIN,$ASCII_SPC_MAX; return strtr(strtoupper($text),$ASCII_SPC_MIN,$ASCII_SPC_MAX); } function str2lower($text) { global $ASCII_SPC_MIN,$ASCII_SPC_MAX; return strtr(strtolower($text),$ASCII_SPC_MAX,$ASCII_SPC_MIN); } function ucsmart($text) { global $ASCII_SPC_MIN; return preg_replace( '/([^a-z'.$ASCII_SPC_MIN.']|^)([a-z'.$ASCII_SPC_MIN.'])/e', '"$1".str2upper("$2")', str2lower($text) ); } ?> Massimiliano Cuttini ---- Server IP: 213.92.11.19 Probable Submitter: 87.0.141.1 ---- Manual Page -- http://www.php.net/manual/en/function.ucwords.php Edit -- https://master.php.net/note/edit/69692 Del: integrated -- https://master.php.net/note/delete/69692/integrated Del: useless -- https://master.php.net/note/delete/69692/useless Del: bad code -- https://master.php.net/note/delete/69692/bad+code Del: spam -- https://master.php.net/note/delete/69692/spam Del: non-english -- https://master.php.net/note/delete/69692/non-english Del: in docs -- https://master.php.net/note/delete/69692/in+docs Del: other reasons-- https://master.php.net/note/delete/69692 Reject -- https://master.php.net/note/reject/69692 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117228) next »