Escaping single and double quotes in a string in ruby?

前端 未结 9 796
忘了有多久
忘了有多久 2020-12-05 09:33

How can I escape single and double quotes in a string?

I want to escape single and double quotes together. I know how to pass them separately but don\'t know how to

9条回答
  •  有刺的猬
    2020-12-05 09:42

    I would use just: str = %(ruby 'on rails ") Because just % stands for double quotes(or %Q) and allows interpolation of variables on the string.

提交回复
热议问题