Re: Capitalization of variable

From: Date: Thu, 19 Jun 2008 05:47:58 +0000
Subject: Re: Capitalization of variable
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-275573@lists.php.net to get a copy of this message
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. Regards, Paul __________________________ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com

« previous php.general (#275573) next »