Is there a Perl-compatible regular expression to trim whitespace from both sides of a string?

前端 未结 13 933
醉话见心
醉话见心 2021-02-08 07:45

Is there a way to do this in one line?

$x =~ s/^\\s+//;
$x =~ s/\\s+$//;

In other words, remove all leading and trailing whitespace from a stri

13条回答
提交回复
热议问题