From: David Alan Black Date: 2002-07-23T12:49:19+09:00 Subject: Re: Strings and member-operators Hi -- To atone for the fact that my earlier suggestions didn't do what the original post asked for (as pointed out by Dossy on irc), I have written a version that passes Dossy's tests. On Tue, 23 Jul 2002, Dossy wrote: > class String > def stripQuotes > self =~ /^"(.*)"$/ > ($1 || self).strip > end > end Here's my version: class String def stripQuotes /^("?)(.*?)(\1)$/.match(self)[2].strip end end and one contribution to the test suite: def test_empty_string assert_equal("", "".stripQuotes) end David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav