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 answers

i 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

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -