develooper Front page | perl.perl5.porters | Postings from May 2021

Re: Revisiting trim

Thread Previous | Thread Next
From:
=?utf-8?Q?Alberto_Sim=C3=B5es?=
Date:
May 26, 2021 21:14
Subject:
Re: Revisiting trim
Message ID:
23V8kZiq6e0uzhtFLor3ys1Ig3A0NB3KqNGaAIxU-aPfP0_3LicJnU4u4NkP_LWkgLL1U07oxaZQx1auEFT7lQ7QYjpQgs5HYj-BXt8HnUQ=@zbr.pt
On Wednesday, May 26th, 2021 at 21:55, Uri Guttman <uri@stemsystems.com> wrote:

> what about trimmed using context? in a void context it trims in place. in scalar (or non-void) it returns the trimmed string and leaves the input unchanged. only one new function and we use context everywhere so it is familiar.

While I like the idea, we would need to make other methods to have similar behavior:
- lc / uc / ucfirst
- chomp / chop
and probably others.

My 5 cents
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