At 12:44 30.10.2002 -0500, Stephens, Wes (N-Sybase) wrote:
Is there a string manipulation function to automatically trim leading and
trailing whitespaces?
No, but do it with regex:
$string =cat and dog ;
# trim beginning ws
$string =~ s/^\s+//;
# trim ending ws
$string =~ s/\s+$//;
: Wednesday, October 30, 2002 7:44 PM
To: ActivePerl (E-mail); Perl-Win32-Users (E-mail)
Subject: Trimming Leading and Trailing Whitespaces
Is there a string manipulation function to automatically trim leading and
trailing whitespaces?
For example:
Problem:
$string =cat and dog
$string = cat and dog;
$string =~ s/^\s+(.*)\s+$/$1/;
-Original Message-
From: Stephens, Wes (N-Sybase) [mailto:wes.stephens;lmco.com]
Sent: Wednesday, October 30, 2002 11:44 AM
To: ActivePerl (E-mail); Perl-Win32-Users (E-mail)
Subject: Trimming Leading and Trailing
: Trimming Leading and Trailing Whitespaces
$string =cat and dog ;
$string =~ s,^\s+(.+?)\s+$,$1,;
print $string;
-Original Message-
From: [EMAIL PROTECTED]
[mailto:perl-win32-users-admin;listserv.ActiveState.com]On Behalf Of
Stephens, Wes (N-Sybase)
Sent: Wednesday, October 30
[EMAIL PROTECTED] wrote, on Wednesday, October 30, 2002 1:11 PM
: Doesn't Perl have Trim function?
Obviously you're confusing Perl with VB. B^)
Joe
==
Joseph P. Discenza, Sr. Programmer/Analyst
Oh how true... Where are my manners... ;-)
-Original Message-
From: Joseph P. Discenza [mailto:jdiscenza;carletoninc.com]
Sent: Wednesday, October 30, 2002 10:52 AM
To: [EMAIL PROTECTED]; 'Perl-Win32-Users (E-mail)'
Subject: RE: Trimming Leading and Trailing Whitespaces
[EMAIL PROTECTED