|
-
June 30th, 1999, 08:17 AM
#1
Perl function for TrimRight
Is there a function in Perl equivalent to TrimRight. I need to trim the trailing chars '0' from a string.
Can you help me?
-
June 30th, 1999, 09:43 AM
#2
Re: Perl function for TrimRight
might require Perl 5:
$_= "the string000";
s/(.*?)0*$/$1/gi;
print($_);
-
June 30th, 1999, 10:09 AM
#3
Re: Perl function for TrimRight
Thanks !
It was veri helpfull !
But I wolu like to ask you something more.
I have a value, for exemple:
$_ = "1234.0000";
#i execute your code
s/(.*?)0*$/$1/gi;
and the string is "1234."
How can I also remove the trailing "." ?
I would be very gratefull to you if you could help me out ...
-
June 30th, 1999, 10:10 AM
#4
Re: Perl function for TrimRight
$_= "1234.000";
s/(.*?)\.?0*$/$1/gi;
print($_);
-
June 30th, 1999, 10:29 AM
#5
Re: Perl function for TrimRight
You-ve been great !
Thank you !
I gave you 3 grades.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|