Re: Name Capitalization

From: Date: Mon, 19 Mar 2007 19:33:59 +0000
Subject: Re: Name Capitalization
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-250834@lists.php.net to get a copy of this message
HI Chris,
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...
I think the better solution would be some pregs that would go through and look for "mc" then have it turn the name into "Mc" then Capitalize the next letter. [same thing for "mac"] Then Do the same thing with "O'Henry" it would look for "o\' " then it would turn it into "O' " and capitalize the "H".
Let us know when you're done! :)
This project shouldn't be that hard as there are probably only 10 to 15 rules for names. Take Care, -- Leonard Burton, N9URK http://www.jiffyslides.com service@jiffyslides.com leonardburton@gmail.com "The prolonged evacuation would have dramatically affected the survivability of the occupants."

« previous php.general (#250834) next »