Removing double qoutes from a string

Hi all… I want to remove leading and trailing double quotes from a
string… and I dont want to add anything to that string… I just want to
remove that double quotes… How could I achieve that? ? Is There any
easy way? I have tried something like.,

for example
a = “hai” I need the output like a = hai
a.gsub(/"/)

and

a.gsub “”" ‘’

I am searching for something like strip! which remove leading and
trailing whitespaces in the string…

Kindly please help me.

#gsub, #tr and #delete do the job:

irb(main):001:0> s = ‘asd " asdds " asdd "’
=> “asd " asdds " asdd “”
irb(main):002:0> s.gsub /”/, ‘’
=> "asd asdds asdd “’
irb(main):004:0> s.tr '”’, ‘’
=> “asd asdds asdd "
irb(main):006:0> s.delete '”’
=> "asd asdds asdd "

Ivan L. wrote in post #1182344:

#gsub, #tr and #delete do the job:

irb(main):001:0> s = ‘asd " asdds " asdd "’
=> “asd " asdds " asdd “”
irb(main):002:0> s.gsub /”/, ‘’
=> "asd asdds asdd “’
irb(main):004:0> s.tr '”’, ‘’
=> “asd asdds asdd "
irb(main):006:0> s.delete '”’
=> "asd asdds asdd "

Thank you Ivan…
But., Can I get like.,

=> asd asdds asdd

I dont want this leading and trailing quotes… How can I get that?

Ivan L. wrote in post #1182346:

Oh, I misunderstood what you asked. Why do you need something like that?

I am using a search box in my project… when I search a product., I cant
match it., I think it is because of that double quotes. that is why., I
am searching for a query which removes double quotes…

Oh, I misunderstood what you asked. Why do you need something like that?

I am using a search box in my project… when I search a product., It
take the searching data within double quotes,so it couldn’t search
because of double quotes.how to remove the double quotes

ex:
params=“3m”
model.where(:value=>/“3m”/) not working

model.where(:value=>/3m/) working

i couldn’t use like keyword because of mongodb

s = ““asd asdds asdd””

puts s
“asd asdds asdd”

puts s.gsub(/\A"|"\z/,’’)
asd asdds asdd

Joel P. wrote in post #1182365:

s = ““asd asdds asdd””

puts s
“asd asdds asdd”

puts s.gsub(/\A"|"\z/,’’)
asd asdds asdd

Thanks Joel.

But is it possible to bring without puts??

Sure, just take away “puts” from that line.