How do I remove white space in a Perl string?

后端 未结 12 1906
离开以前
离开以前 2020-12-31 09:34

If I declared a variable $myString with the value \'3 \' (notice the white space). Is there any function to remove the white space for the return v

12条回答
  •  一生所求
    2020-12-31 09:53

    If you are willing to use a CPAN module then String::Util, or the somewhat more economical Text::Trim would be possible choices.

    Trimming strings is one of those bike sheds that everyone likes to build! See the short perlmaven tutorial by @szabgab for a small sample of TIMTOWDI fun.

提交回复
热议问题