On 2/26/07, jm <[EMAIL PROTECTED]> wrote:
is there a function, module, script, etc. that converts all uppercase to
proper mixed case. this particular need is for an address list that is all
uppercase
1370 W 14TH ST
ADA,OK
74837
i would like to convert it to
1370 W. 14th St.
Ada, OK
74837
thanks for any help,
joe
Joe,
Not that I know of, but search CPAN for 'postal address' just in case.
The problem here--and the reason the latest post office standards use
all caps--is that there is no good rule. some thing like:
foreach my $linein (split /\n/, $addressin) {
push @newaddress, join(" ", map {ucfirst(lc($_))} split /\s/, $linein;
}
$addressout = join "\n", @newaddress;
looks good at first, but it makes a mess things like :
200 E FIRST ST, APT PC
113 W 60TH ST, SUITE 2E
Not to mention two-letter state abbreviations and ISO country codes.
I used to do direct mail (I know, I know), and I can tell you from
experience that if if it's a t all possible, it's much better to just
use uc() on everything if you can.
Geo::PostalAddress would let you parse out the state and country codes
for special treatment, but there is still no good way to handle
apartment and suite numbers, which can have all kinds of screwy
things.
Best,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org
values of β will give rise to dom!