Re: converting to mixed case
- From: a.r.ferreira@xxxxxxxxx (Adriano Ferreira)
- Date: Mon, 26 Feb 2007 15:18:44 -0300
On 2/26/07, jm <jm5379@xxxxxxxxx> 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
- Follow-Ups:
- Re: converting to mixed case
- From: Jm
- Re: converting to mixed case
- From: John W. Krahn
- Re: converting to mixed case
- References:
- converting to mixed case
- From: Jm
- converting to mixed case
- Prev by Date: Re: BInding operator fails
- Next by Date: Re: BInding operator fails
- Previous by thread: converting to mixed case
- Next by thread: Re: converting to mixed case
- Index(es):