Re: Normalising Names
| From: | Curt Zirzow | Date: | Fri, 14 May 2004 03:36:27 +0000 |
| Subject: | Re: Normalising Names | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186198@lists.php.net to get a copy of this message | ||
* Thus wrote Justin French (justin@indent.com.au):
> 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."