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

Re: Request review for adding a text trim() function to core

Thread Previous | Thread Next
From:
Eric Brine
Date:
July 21, 2020 18:35
Subject:
Re: Request review for adding a text trim() function to core
Message ID:
CALJW-qGL9ijz4+-qHSvhLrLTDSywq+r9V1ANkjf9tFViAxMF=A@mail.gmail.com
Having a function to trim both ends but not one to trim trailing whitespace
is really weird to me. Virtually every program I write needs the latter
(though I usually settle for chomp).

On Tue, Jul 21, 2020 at 1:59 PM Scott Baker <scott@perturb.org> wrote:

> It's been a personal pet peeve of mine that Perl has never had a *trim()*
> function in core. After discussion
> <https://github.com/Perl/perl5/issues/17952> with Grinnz, Leonerd, and
> others we decided to move forward with seeing what it would take to add it
> to core. I wrote documentation and tests, and LeoNerd wrote the actual
> implementation. Now I'm here soliciting feedback on this feature before I
> submit a formal PR.
>
> You can checkout my branch here:
> https://github.com/scottchiefbaker/perl5/tree/trim
>
> Once it's built the easier way to test it is: ./perl -Ilib -E 'say
> CORE::trim("   Hello world!    ");'
>
> You will get an experimental warning, but the function should work and
> remove the whitespace.
>
> - Scottchiefbaker
>

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