How to strip leading and trailing quote from string, in Ruby

Viewed 65131

I want to strip leading and trailing quotes, in Ruby, from a string. The quote character will occur 0 or 1 time. For example, all of the following should be converted to foo,bar:

  • "foo,bar"
  • "foo,bar
  • foo,bar"
  • foo,bar
9 Answers
Related