Hi,
I need to replace ’ by '. How can I do that?
Thanks
Hi,
I need to replace ’ by '. How can I do that?
Thanks
David N. wrote:
Hi,
I need to replace ’ by '. How can I do that?Thanks
This was harder than I thought…in “vi”(vim actually) I just had to:
1,$ s/’/\’/g
But Ruby didn’t seem to like that…
Anyway, for reasons unknown to me, this works:
puts “‘hello’”.gsub("’","\\’")
Cheers
John
From: John Pritchard-williams [mailto:[email protected]]
how i wish the behaviour would change.
search the archives. this is a faq
if like me, you want to lessen the those fences
try,
“‘hello’”.gsub("’") { “\’” }
#=> “\‘hello\’”
or
“‘hello’”.gsub “’”, %q[\’]
#=> “\‘hello\’”
for obvious reason, my brain prefers the former
kind regards -botp
//how i wish the behaviour would change.
search the archives. this is a faq :)//
oops sorry (I did it again)…perhaps you could include the link to
where this is explained though…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs