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

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -