-1

I have a string that has a value that I want to be in quotes. Following is the text which I currently have:

text = "#{value1} has viewed your #{value2}"

I want value2 to be in quotes. I want:

text = ""#{value1} has viewed your "#{value2}""

How can I implement this? Any help will be appreciated.

sawa
  • 165,429
  • 45
  • 277
  • 381
Charles Skariah
  • 670
  • 6
  • 18
  • Your expected result is invalid. Also it looks as if you want to add three quotes. It is not clear how that relates to your claim that you want to put `value2` in quotes. – sawa Mar 09 '16 at 08:53

1 Answers1

5
text = %Q|#{value1} has viewed your "#{value2}"|
text = "#{value1} has viewed your \"#{value2}\""

or even:

text = "#{value1} has viewed your" '"' "#{value2}" '"'

More info.

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160