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:
Dan Book
Date:
November 18, 2020 16:37
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
CABMkAVX4OULLixheBbSkyavXddbfbcsYUgY-e_YtPSzdexkMxA@mail.gmail.com
On Wed, Nov 18, 2020 at 3:17 AM L A Walsh <Astara@tlinx.org> wrote:

> On 2020/11/05 10:09, Scott Baker wrote:
> >
> > Team:
> >
> > I lack the time and expertise to complete the PR I started
> > <https://github.com/Perl/perl5/pull/17999> to add `trim()` to core.
> >
> ---
>     To be clear, what is 'trim' supposed to do in perl?
>
>     When I do a 'man trim', I see what looks like a trim in the
> textutil::trim, but it looks like it might be related to Tcl?
>
>     Either way, does it take 1 or 2 params, like shown for
> textutil::trim:
>
>   trim "string", Regexp;
>
> Where to trim whitespace, you might have:
>
>   trim "string", m{\s};
>
> But in trim, it shows related trim functions:
>      trim::trim{left,right,Prefix,EmptyHeading}
>
> Does trim, by itself, only trim the <??> at beginning or end or both?
> Is it intended to take a Regex, or is it only used to trim spaces, or
> what is the intended functionality?
>
> If it deletes before + after, would that imply a need (at least)
> for right+left trims?
>
> I looked at your link, but didn't intended functionality.
>
> Should I assume the trim there is of the same variety?
>
>     ::textutil::trim::trim string ?regexp?
>       Remove in string any leading and trailing substring according to
>       the  regular  expression  regexp  and return the result as a new
>       string.
>
> Does that imply variations on the function might also be needed?
>
> Sorry, I'm guessing there is some standard definition and maybe I
> accidently
> hit on it, but just trying to make sure.
>
> Thanks!
>

The documentation added by the PR explains it. It removes leading and
trailing whitespace.

-Dan

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