From: Tom Sawyer Date: 2002-07-23T09:03:59+09:00 Subject: Re: Strings and member-operators On Mon, 2002-07-22 at 17:05, the Bare wrote: > I'm looking for a way to strip the quotes (and whitespace) off of a > string. class String # removes single or double quotes from around string def unquote astr = self.dup.strip if astr[1..1] == '"' return astr.reverse.chomp('"').reverse.chomp('"') elsif astr[1..1] == "'" return astr.reverse.chomp("'").reverse.chomp("'") end end # Inplace unquote def unquote! self.replace(unquote) end end as you can see i added this to the String class so its available all the time. but now that i think about it, it would probably be better to use: return astr[1..-2] don't you think? ~transami