I want to print escaped or raw version of a string. For example: given this string:
"a,
b,
c,
d"
I want to get
"a,\nb,\nc,\nd".
Is it possible?
s = "a,
b,
c,
d"
s.dump
# => "\"a,\\nb,\\nc,\\nd\""
s.dump[1...-1]
# => "a,\\nb,\\nc,\\nd"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With