I have a string str = "xyz\123"
and I want to print it as is.
The IRB is giving me an unexpected output. Please find the same below:-
1.9.2p290 :003 > str = "xyz\123"
=> "xyzS"
1.9.2p290 :004 >
Any ideas on how can I get IRB to print the original string i.e. "xyz\123".
Thank you..
UPDATE :
I tried escaping it , but it doesn't seem to be that simple for some reason. Please find below my trials with the same:
1.9.2p290 :004 > str = "xyz'\'123"
=> "xyz''123"
1.9.2p290 :005 > str = "xyz'\\'123"
=> "xyz'\\'123"
1.9.2p290 :006 > str = "xyz'\\\'123"
=> "xyz'\\'123"
1.9.2p290 :007 >
.inspect
as well. – Cuttlefish