Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Re: Re: ChAnGiNg CaSe of forms before they are submitted?

by gav^ (Curate)
on Apr 21, 2002 at 18:28 UTC ( [id://160909]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: ChAnGiNg CaSe of forms before they are submitted?
in thread ChAnGiNg CaSe of forms before they are submitted?

You're right, it should probably be called 'mixed case'.
sub sentance { my $s = shift; $s =~ s/^(\w)(.+)$/\U$1\L$2/g; return $s; } sub mixed { my $s = shift; $s =~ s/\b(\w)(\w+)\b/\U$1\L$2/g; return $s; } sub headline { my $s = shift; $s =~ s/\b(\w)(\w+)\b/length($2)>2?uc($1).lc($2):lc($1.$2)/eg; return ucfirst($s); } chomp(my @sentances = <DATA>); foreach my $fn (qw(sentance mixed headline)) { print $fn, "\n"; foreach my $s (@sentances) { print "\t", &{$fn}($s), "\n"; } } __DATA__ this is a test this is a headline blah blah BLAH blah the cat sat on the mat we are all brothers at perlmonks

gav^

  • Comment on Re: Re: Re: Re: Re: ChAnGiNg CaSe of forms before they are submitted?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found