RE: [PHP] Name Capitalization
| From: | Chris W. Parker | Date: | Mon, 19 Mar 2007 19:16:44 +0000 |
| Subject: | RE: [PHP] Name Capitalization | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250831@lists.php.net to get a copy of this message | ||
On Monday, March 19, 2007 10:24 AM Leonard Burton
<mailto:leonardburton@gmail.com> said:
> For instance, McDonald needs to remain that way even if it comes in as
> MCDONALD, or mcdonald.
[snip]
> Yeah, nothing is a "perfect solution" but anything is better than
> nothing.
That's probably true when you're talking about cash in your pocket but
probably not in this case.
> Guys, Thanks for the replies and the link to the recent thread, even
> though that didn't discuss any solutions to the problem I am asking
> about (other than to point it out which helps because it points out a
> few of the name problems)!
That's because there are no solutions. There are "options" but not
solutions.
Here is one option. Make a long list (array) of search/replace pairs and
loop through your text replacing as necessary.
'mcdonald' => 'McDonald'
'mcdowell' => 'McDowell'
'o\'reilly' => 'O\'Reilly'
'de la rosa' => 'De La Rosa'
etc ad nauseum...
Let us know when you're done! :)
Also, there's no difference between MCDONALD and mcdonald if you convert
everything to lower (or upper) case first.
Thanks,
Chris.