thanks to all for your suggestions.  Adriano had exactly what i was looking
for:

$address =~ s/(\w)(\w*)/\u$1\L$2/g;

works like a charm.
i should have left out the periods and uppercase state abbreviations, i'm
sure that didn't help clarify what i wanted.

thanks again.



On 2/26/07, Adriano Ferreira <[EMAIL PROTECTED]> wrote:

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

Doing it blindly, can be easily achieved with regexes:

$address =~ s/(\w)(\w*)/\u$1\L$2/g;

which applied over each line of

> 1370 W 14TH ST
> ADA,OK
> 74837

results in

1370 W 14th St
Ada,Ok
74837

which is not perfect, because it is pretty dumb as I said. To do a
better job, you need to sophisticate the recognition of the address
pieces and then apply s/(\w)(\w+)/\u$1/\L$2/ selectively to the parts
(plus your extra tidyings like a trailing dot and extra spaces).

Note. Converting a word into first letter in upper case and the
remaining in lower case, can also be done with     s/(\w+)/\L\u$1/


> 1370 W. 14th St.
> Ada, OK
> 74837
>
> thanks for any help,
> joe
>
> --
> since this is a gmail account, please verify the mailing list is
included in
> the reply to addresses
>




--
since this is a gmail account, please verify the mailing list is included in
the reply to addresses

Reply via email to