Re: Capitalization of variable
| From: | Nathan Nobbe | Date: | Thu, 19 Jun 2008 07:57:03 +0000 |
| Subject: | Re: Capitalization of variable | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275577@lists.php.net to get a copy of this message | ||
On Wed, Jun 18, 2008 at 11:47 PM, Paul Novitski <paul@juniperwebcraft.com>
wrote:
> At 6/18/2008 09:38 PM, Nathan Nobbe wrote:
>
>> $streetAddr = "817 17th ST, DENVER COLORADO";
>> echo ucwords(strtolower($streetAddr));
>> // 817 17th St, Denver Colorado
>>
>
>
> I'd like to mention that, in practical usage, capitalizing the first letter
> of every word does not correctly capitalize addresses in most languages
> expressed in Roman script. In North America we see numerous common
> exceptions such as PO, APO, NE/NW/SE..., MacDonald, Macdonald, deCamp,
> D'Angelo, de la Rosa, Apt. 3E, et cetera, et cetera. If you're serious
> about correcting a mailing list for upper- & lowercase, I suggest you build
> or use a replacement dictionary that's smart about postal addresses and
> smart about the languages you're liable to encounter. If you're in North
> America, a simple correcting algorithm is pretty much impossible because of
> the damage done by "Ellis Island" that has rendered the spelling of names
> arbitrary, even random, and often incorrect relative to their origins. Good
> luck! But don't give up -- as Xeno will attest, your earnest attempt to
> reach the tree with your arrow will gain praise even if it's doomed never to
> actually arrive.
right; this is very valid, and while i was tempted to delve into such tirade
myself i held back to answer the question as directly as possible. but yes,
the post i made before is not something i would ever use to parse and store
/ use an address supplied by a user, nor would i recommend it be used in
such a way be anyone else ;)
-nathan