remove blanks

2003-09-29 Thread perl
Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; There got to be one out there! thanks, -rkl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: remove blanks

2003-09-29 Thread James Edward Gray II
On Monday, September 29, 2003, at 07:04 PM, [EMAIL PROTECTED] wrote: Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; We could combine those: $username =~ s/^\s*(.*?)\s*$/$1/; Hope that helps. James -- To

RE: remove blanks

2003-09-29 Thread Hanson, Rob
foox200); } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: remove blanks Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s

Re: remove blanks

2003-09-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; There got to be one out there! Doing it in two steps is the way to go. Don't try to make one regex out of it. I usually write it this

Re: remove blanks

2003-09-29 Thread perl
this looks convenience thanks, -rkl [EMAIL PROTECTED] wrote: Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; There got to be one out there! Doing it in two steps is the way to go. Don't try to make one

RE: remove blanks

2003-09-29 Thread perl
:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: remove blanks Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; There got to be one out there! thanks, -rkl

RE: remove blanks

2003-09-29 Thread perl
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: remove blanks Is there a func or a onliner for removing blanks from both ends? I'm using these: $username =~ s/^\s+//; $username =~ s/\s+$//; There got to be one out

RE: remove blanks

2003-09-29 Thread Jeff 'japhy' Pinyan
On Sep 29, Hanson, Rob said: I ran some benchmarks. The two-liner outperformed the one-liners by a 10 to 1 ratio. Code and results below. Benchmark: timing 10 iterations of OneLine, OneLine2, TwoLines... OneLine: 41 wallclock secs (39.30 usr + 0.00 sys = 39.30 CPU) @ 2544.79/s