[KLUG Members] Perl string trim
   
    Tony Gettig
     
    members@kalamazoolinux.org
       
    30 Jul 2002 11:35:47 -0400
    
    
  
Justin, Jacob, and others,
Awesome! Thanks tons! Works perfectly!
I guess I need to learn regular expressions a little better. :) Thanks
again!
On Tue, 2002-07-30 at 11:09, Buist Justin wrote:
> $string =~ s/^\s+//g; # yank leading whitespace out
> $string =~ s/\s+$//g; # yank trailing whitespace out
> 
> That should do it.
> 
> Justin Buist
> 
> 
> > -----Original Message-----
> > From: Tony Gettig [mailto:gettig@chartermi.net]
> > Sent: Tuesday, July 30, 2002 11:05 AM
> > To: members@kalamazoolinux.org
> > Subject: [KLUG Members] Perl string trim
> > 
> > 
> > Hey there,
> > 
> > I've looked, googled, and looked again but I must be missing something
> > obvious. I have a string I need to trim all the extra spaces 
> > off of. For
> > instance, if the variable value is "Dude____________" (where all the
> > underscores are spaces), I want to do something like 
> > STR_TRIM($variable)
> > and get "Dude" returned as the result. I tried writing my own function
> > to do this, which is below (please remember, I'm not a perl programmer
> > :)
...