Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Handling caps for surnames with capitals in the middle (was: Irish Surnames)

by Anonymous Monk
on May 06, 2002 at 12:22 UTC ( [id://164303]=note: print w/replies, xml ) Need Help??


in reply to Handling caps for surnames with capitals in the middle (was: Irish Surnames)

First build a list (i ain't smart), then use it
my @List = qw/ Mac Mc De /; my @NAMES = map ucfirst, qw/ mcginley macgee develera/; for my $name (@NAMES) { for my $match( grep {$name =~/^$_/} @List ) { warn $name; $name =~ s/^\Q$match\E(.*)$/$match.ucfirst($1)/e; warn $name; } }
The output from the above code I get is
Mcginley at - line 6.
McGinley at - line 8.
Macgee at - line 6.
MacGee at - line 8.
Develera at - line 6.
DeVelera at - line 8.
  • Comment on Re: Handling caps for surnames with capitals in the middle (was: Irish Surnames)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164303]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found