For example I'd like to turn
the quick brown fox jumped over the lazy dogs.
to
The Quick Brown Fox Jumped Over the Lazy Dogs.
Is this doable on a single line?
--
Mark Healey
marknews(at)healeyonline(dot)com
What have you tried so far?
Have you read the posting guidelines for this group, posted twice a
week?
Because I'm feeling generous (and bored) anyway:
s/(^|\s)([a-z])/$1\u$2/g;
for more information on ^, |, (), $1 & $2:
perldoc perlre
perldoc perlretut
perldoc perlreref
for more information on \u:
perldoc -f ucfirst
Paul Lalli
my $string = 'the quick brown fox jumped over the lazy dogs.';
my $String = join ' ', map {ucfirst lc} split ' ', $string;
That forces your string to lower case first then capitalizes the first
letter. It won't preserve whitespace though.
--
Glenn Jackman
NCF Sysadmin
gle...@ncf.ca