Stop Ruby from Automatically Escaping Strings -


if have string "this \#test" , drop python shell, 'this \\#test', behavior looking for. if drop ruby shell, "this #test" no indication backslash had been present. how make ruby string behave python, is, without automatically escaping # sign?

using single quotes when dont want escape sequences interpreted.

[1] pry(main)> 'this \#test' => "this \\#test" 

single quotes not string interpolation, if need both, can escape slash manually:

[1] pry(main)> t = "test" ; "this \\##{t}" => "this \\#test" 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -