note 75088 deleted from function.ucwords by nlopess
| From: | nlopess@php.net | Date: | Sat, 12 May 2007 11:22:51 +0000 |
| Subject: | note 75088 deleted from function.ucwords by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126433@lists.php.net to get a copy of this message | ||
Note Submitter: david at carrcommunications dot com
----
Here's a simple routine I came up with to fix user data entry where people are too lazy to
capitalize anything. I wanted to fix lowercase names without messing with those that might start
with a lower case letter (like "de Angelo" as a last name).
function FixCap ($value) {
// if there's a capital letter in here somewhere, don't mess with this value. Otherwise,
ucwords
if( ereg("[A-Z]",$value) )
return $value;
else
return ucwords($value);
}