regex - How to make only the first character in each word uppercase in Perl -
regex - How to make only the first character in each word uppercase in Perl -
this question has reply here:
how can capitalize first letter of each word in string in perl? 9 answersi have string containing uppercase words , want create first letter of each word uppercase or convert first character lowercase. i've been messing around regex while , can't right.
my $str = "foobar foobar"; $str =~ s/(\s+)/\u\l$1/g; print $str;
output
foobar foobar
check ucfirst
, lc
in perldoc.
regex string perl
Comments
Post a Comment