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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php