Re: String trim method

2016-01-31 Thread Tom Browder
On Sunday, January 31, 2016, yary wrote: > On Sun, Jan 31, 2016 at 9:29 AM, Tom Browder wrote: >> I don't find '.=' in the operator list. Thanks. > > It's like "+=" > > "$a .= foo(...)" is the same as "$a = $a.foo( ... )" > > Took me a bit to get my head around it when I first encountered it, no

Re: String trim method

2016-01-31 Thread Tom Browder
On Sunday, January 31, 2016, Parrot Raiser <1parr...@gmail.com> wrote: > On 1/31/16, Tom Browder wrote: ... > > Brandon, can you (or anyone else) please explain the statement above? > > I don't find '.=' in the operator list. Thanks. > From http://doc.perl6.org/routine/trim "In order to do in-pla

Re: String trim method

2016-01-31 Thread yary
On Sun, Jan 31, 2016 at 9:29 AM, Tom Browder wrote: > I don't find '.=' in the operator list. Thanks. It's like "+=" "$a .= foo(...)" is the same as "$a = $a.foo( ... )" Took me a bit to get my head around it when I first encountered it, now it's like "why don't more languages do this!" (th

Re: String trim method

2016-01-31 Thread Parrot Raiser
>From http://doc.perl6.org/routine/trim "In order to do in-place trimming, once (sic) needs to write .=trim" On 1/31/16, Tom Browder wrote: > On Wednesday, August 5, 2015, Brandon Allbery wrote: >> On Wed, Aug 5, 2015 at 6:47 PM, Tom Browder >> wrote: >>> I see that to trim white space from a s

String trim method

2016-01-31 Thread Tom Browder
On Wednesday, August 5, 2015, Brandon Allbery wrote: > On Wed, Aug 5, 2015 at 6:47 PM, Tom Browder wrote: >> I see that to trim white space from a strings's both ends I have to do this: >> >> my $s = ' yada yada '; >> $s = $s.trim; >> >> Is that the optimum way? > > I don't know what you m

Re: String trim method

2015-08-06 Thread Tom Browder
On Thu, Aug 6, 2015 at 2:23 AM, Brent Laabs wrote: > I think the optimal way would be: > >my $s = 'yada yada'; > > That way the program won't have to trim the whitespace off the string every > time it is run. > > In the more general case, I might do it something like: > > my $s = something-

Re: String trim method

2015-08-06 Thread Brent Laabs
I think the optimal way would be: my $s = 'yada yada'; That way the program won't have to trim the whitespace off the string every time it is run. In the more general case, I might do it something like: my $s = something-returning-a-string().trim; But I don't think that there really is a

Re: String trim method

2015-08-05 Thread Tom Browder
On Wed, Aug 5, 2015 at 6:00 PM, Brandon Allbery wrote: > I don't know what you mean by "optimal" there, but you can say something > like > > $s .= trim; I really meant the preferred or best practice way. Thanks, Brandon! -Tom

Re: String trim method

2015-08-05 Thread Brandon Allbery
On Wed, Aug 5, 2015 at 6:47 PM, Tom Browder wrote: > I see that to trim white space from a strings's both ends I have to do > this: > > my $s = ' yada yada '; > $s = $s.trim; > > Is that the optimum way? > I don't know what you mean by "optimal" there, but you can say something like

String trim method

2015-08-05 Thread Tom Browder
I see that to trim white space from a strings's both ends I have to do this: my $s = ' yada yada '; $s = $s.trim; Is that the optimum way? Thanks. Best regards, -Tom