String.strip( string_to_strip )

Thanks for the critique, Austin. Nice code. I also came across a
thread from July on the same subject (while searching for something
completely unrelated, isn’t that always the way? ), so sorry for the
duplication. I am wondering whether the regexp anchors could/should be
\A, \Z instead of ^, $ …

Al

···

-----Original Message-----
From: Austin Ziegler [mailto:austin@halostatue.ca]
Sent: Saturday, December 20, 2003 6:50 AM
To: ruby-talk ML
Subject: Re: String.strip( string_to_strip )

On Sat, 20 Dec 2003 08:05:36 +0900, Albert Chou wrote:

I’ve wanted a String.strip( string_to_strip ) method to augment
the existing strip() method for a long time, and today I TDD’ed
myself one. Anyone else have a use for such a thing?

Not really :slight_smile: At first, I wasn’t understanding what your code was
trying to do. However, I think that you’ll find the attached code a
bit more comprehensible. It also properly returns a copy of the
modified code, whereas your original version modifies the original
string.

-austin

austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.12.20
* 09.50.00

Oh, probably. I’m sort of hoping that Ruby regexen will be simplified the
way that Perl 6 regexen will be simplified for Ruby2. I should probably
write up an RCR for that. I especially like the distinction of ^ for the
beginning of line and ^^ for absolute beginning of string…

-austin

···

On Tue, 23 Dec 2003 05:53:23 +0900, Albert Chou wrote:

Thanks for the critique, Austin. Nice code. I also came across a thread
from July on the same subject (while searching for something completely
unrelated, isn’t that always the way? ), so sorry for the duplication.
I am wondering whether the regexp anchors could/should be \A, \Z instead
of ^, $ …


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.12.22
* 20.43.16