php-general | 2003022
Date: 02/28/03
- Next message: Tom Rogers: "Re: [PHP] Help with Sessions"
- Previous message: Ernest E Vogelsinger: "Re: [PHP] strip http headers"
- In reply to: Jon Haworth: "RE: [PHP] Capitalising Personal Names"
- Next in thread: Geoff Caplan: "Re[2]: [PHP] Capitalising Personal Names"
- Reply: Geoff Caplan: "Re[2]: [PHP] Capitalising Personal Names"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Maybe a script that tests the entry, and asks the user to reconfirm
nonstandard spelling and capitalization. Something like...
if ($name != ucwords($name) {
//script that suggests ucwords($name) as a possible correction
//but allows the user to confirm nonstandard capitalization scheme
//by re-entering the name.
}
Then what goes into the database is either
a) standard format, or
b) has been confirmed by the user.
Dave O'Meara
"Jon Haworth" <jhaworth <email protected>> wrote in message
news:67DF9B67CEFAD4119E4200D0B720FA3F0241EDF7 <email protected>
> Hi Danny,
>
> > > I need to clean up the capitalisation of user-entered personal names.
> >
> > Well it's hardly rocket science - a flick through the manual and I
> > came up with :
> > $name=ucwords(strtolower($name));
>
> While that would work in many cases, how do you catch exceptions such as
the
> following?
>
> <?php
>
> $names[] = "Ludwig van Beethoven";
> $names[] = "Ronald MacDonald";
> $names[] = "Alexis de Tocqueville";
> $names[] = "Tim O'Reilly";
>
> foreach ($names as $name)
> echo $name. " -> ". ucwords(strtolower($name)). "<br />";
>
> ?>
>
> Cheers
> Jon
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Tom Rogers: "Re: [PHP] Help with Sessions"
- Previous message: Ernest E Vogelsinger: "Re: [PHP] strip http headers"
- In reply to: Jon Haworth: "RE: [PHP] Capitalising Personal Names"
- Next in thread: Geoff Caplan: "Re[2]: [PHP] Capitalising Personal Names"
- Reply: Geoff Caplan: "Re[2]: [PHP] Capitalising Personal Names"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

