From: Dossy Date: 2002-07-24T01:23:13+09:00 Subject: Re: Strings and member-operators On 2002.07.24, Tom Sawyer wrote: > let me get this straight? is the original question how to strip a string > and remove quotes? > > /^("?)(.*)\1$/.match(self)[2].strip > > this only does double quotes and its striping after the quotes removal. > is that what's wanted? well, i'll assume so. what about without regexp? > > return str[1..-1].strip if str[0..0] + str[-1..-1] == '""' > > hmmm... you'd think there'd be a real simple way to do this without > regexp, can it get any simpler? It's faster using regexp. Fewer intermediate temporary objects created. -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)