note 109198 added to function.ucwords
| From: | PatriceVanneufville | Date: | Wed, 27 Jun 2012 01:50:14 +0000 |
| Subject: | note 109198 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188891@lists.php.net to get a copy of this message | ||
Voici une fonction qui prend en compte les espaces et les tirets :
(Make the first letter of any word in capital even they are separated by hyphen)
<?php
function ucwordspecific($str) {
return preg_replace('/(?<=^|-| )(.?)/e',"strtoupper('$1')", $str);
}
?>
L'exemple : ucwordspecific("mark-yves robert-bryan")
donne : "Mark-Yves Robert-Bryan"
----
Server IP: 69.147.83.197
Probable Submitter: 82.224.182.49
----
Manual Page -- http://www.php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/109198
Del: integrated -- https://master.php.net/note/delete/109198/integrated
Del: useless -- https://master.php.net/note/delete/109198/useless
Del: bad code -- https://master.php.net/note/delete/109198/bad+code
Del: spam -- https://master.php.net/note/delete/109198/spam
Del: non-english -- https://master.php.net/note/delete/109198/non-english
Del: in docs -- https://master.php.net/note/delete/109198/in+docs
Del: other reasons-- https://master.php.net/note/delete/109198
Reject -- https://master.php.net/note/reject/109198
Search -- https://master.php.net/manage/user-notes.php