Uppercase first letter of every word





5
Date Submitted Thu. Feb. 16th, 2006 8:37 AM
Revision 1 of 1
Helper digitaljunkie
Tags Perl
Comments 2 comments
I needed a quick way to make a Street Address and City proper case.
Lingua::EN::NameCase works best for peoples names, but it does not work well for Addresses. This is not intended by any means to be complete, but is quick and dirty.

Plus, there are not many Perl snippets here. So, I thought I would start simple :-)
$a = "thIs SeNTenCE iS AlL meSSEd Up!"; $b = join(" ", map ucfirst(lc($_)), split(/\s+/, $a)); print "Before: $a\n"; print "After: $b\n";

Steve Wilder

Steve Wilder
Technology Resource Group
unpack "u", qq(1

Comments

Comments A shorter way
Tue. Oct. 3rd, 2006 3:24 PM    Beginner drench
  Comments Regex!
Mon. Oct. 16th, 2006 11:35 AM    Beginner snevine

Voting