Re: [PATCH] Add .trim method

[email protected] (Ovid) Mon, 12 Jan 2009 08:50:44 -0800 (PST)
Newsgroups perl.perl6.language,perl.perl6.internals
Message-ID <[email protected]>
----- Original Message ----

> From: Larry Wall <[email protected]>

> On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote:
> : ...the trivial $string.trim and trim($string) case.
> 
> Hmm, I'd think .trim should work like .chomp, and return the trimmed
> string without changing the original.  You'd use $str.=trim to do it
> in place.

In the pir, doesn't the "s = self" line copy self, thus ensuring that I'm changing "s" and not "self"?  Or do I need "s = clone self" (or however it's written).

> Can't say I really like the negated options though.  They smell funny.

Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike.  Suggestions welcome as I can't think of anything better.

 
Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6