develooper Front page | perl.perl5.porters | Postings from November 2020

Re: Looking for someone to adopt adding trim() to core

Thread Previous | Thread Next
From:
Christian Walde
Date:
November 26, 2020 13:05
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
op.0uoxbputydyjqt@xenwide.vpn.udag.de
On Thu, 26 Nov 2020 13:51:56 +0100, Vlado Keselj <vlado@dnlp.ca> wrote:

>
> 1050 distributions and 1659 cases!  Wow, that is a strong support for
> "trim".
>
> It is interesting that some of those cases use /g option, which trims all
> lines.  This could be a candidate for the second argument of "trim".
>
> I would guess that not even all alternatives are counted, like:
> s/^\s*(.*)\s*$/$1/

Sadly there is a lot of different ways to do trim, so trim in the PR currently tries to find the most-used one and provide that. Stuff like multi-line trim can be done fairly easily with that one by way of split map join.

That said, as mentioned elsewhere in the thread: Once we have that it can serve as an easier template to do such things in the future.

Also, i recommend reading the PR in entirety as it details why adding arguments to trim() is currently not considered desirable. :)

-- 
With regards,
Christian Walde

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About