note 29691 added to function.ucwords
| From: | un-thesis at wakeup-people dot com | Date: | Fri, 21 Feb 2003 18:53:40 +0000 |
| Subject: | note 29691 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44321@lists.php.net to get a copy of this message | ||
This will capitalize words beginning with every major English punctuation symbol. You can add your
own (foreign) symbols here as well :-)
$words = "What?No delimiters,shit happens;all the time!here:this--solves (definately) [many
more] all problems.";
$words = str_replace(Array("(", "-", ".", "?",
",",":","[",";","!"), Array("( ",
"- ", ". ", "? ", ", ",": ","[ ",";
","! "), $words);
$words = ucwords(strtolower($words));
$words = str_replace(Array("( ", "- ", ". ", "? ", ",
",": ","[ ","; ","! "), Array("(",
"-", ".", "?",
",",":","[",";","!"), $words);
print "$words\n";
--
http://www.php.net/manual/en/function.ucwords.php
http://master.php.net/manage/user-notes.php?action=edit+29691
http://master.php.net/manage/user-notes.php?action=delete+29691
http://master.php.net/manage/user-notes.php?action=reject+29691