From: Albert Chou Date: 2003-12-23T05:53:23+09:00 Subject: Re: String.strip( string_to_strip ) ------_=_NextPart_001_01C3C8CD.860CC06F Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 :) 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 ------_=_NextPart_001_01C3C8CD.860CC06F--