note 18922 added to function.ucwords
| From: | evan at php2 dot chek dot com | Date: | Sun, 10 Feb 2002 00:55:53 +0000 |
| Subject: | note 18922 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26429@lists.php.net to get a copy of this message | ||
The following blurb (should be all one line...) will capitalize all words except for "of",
"a", "the", and "and" (unless they are the first word, in which case
they will be capitalized.)
trim(ucfirst(str_replace(Array("Of ","A ","The ","And
"),Array("of ","a ","the ","and
"),ucwords(strtolower($str)))));
Unfortunately, it won't work w/ acronyms ("U.S.A." comes out "U.s.a."- but
that is a problem w/ ucwords.) There aren't any articles im missing, are there???
--
http://www.php.net/manual/en/function.ucwords.php
http://master.php.net/manage/user-notes.php?action=edit+18922
http://master.php.net/manage/user-notes.php?action=delete+18922
http://master.php.net/manage/user-notes.php?action=reject+18922