Created
May 19, 2014 16:57
-
-
Save zhester/17580f1f63f14f010d50 to your computer and use it in GitHub Desktop.
Title Casing a Phrase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple attempt at faking title case on a phrase. | |
sub titlecase { | |
$_ = shift; | |
my @words = split( / / ); | |
my @twords; | |
foreach ( @words ) { | |
$_ = lc( $_ ); | |
$_ = ucfirst( $_ ); | |
push( @twords, $_ ); | |
} | |
return join( " ", @twords ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment