* Thus wrote Justin French ([EMAIL PROTECTED]): > Hi all, > > Can someone point me in the direction of a function/library/tutorial on > normalising and formatting user-inputted names so that they have the > correct capitalisation etc? > > This will work for MOST situations I'm aware of: > <? > $name = ucwords(strtolower($name)); > ?> > > BUT, this will not work in the following cases: > > 1. where a word will NOT want a first letter capital > (like "Chris de Vidal" off this list)
Names an proper names are a difficult task to handle, I generally let the the fields be as is. Going under the assumptoinn that A person wont enter there name in as "Chris De Vidal". A common solution would to strtoupper() all field's that way this issue never comes up. oh wait, this is 2004 not 1978 :) > My current thinking is to normalise everything to lowercase, uppercase > the words, then handle as many special cases as I can, but KNOWING all > the special cases is half the battle. If you're task is to reformat paticular field's this seems to be the only logical approach. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php