Escaping single and double quotes in a string in ruby?

前端 未结 9 847
忘了有多久
忘了有多久 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:53

    >> str = "ruby 'on rails\" \" = ruby 'on rails"
    => "ruby 'on rails" " = ruby 'on rails"
    

提交回复
热议问题