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


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to