E
Emmanuel Touzery
Hello,
definitely a very newbie question... i have strings, possibly with
carriage returns in my application, and i want to save them with '\n' in
litteral in my file (so that i'm guaranteed this string is on at most one
line), and then get back "\n" when deserializing.
But i don't quite get it for the deserialization part:
irb(main):001:0> myString = 'a\nb'
"a\\nb"
irb(main):002:0> myString.gsub('\n', "\n")
"a\\nb"
irb(main):003:0> myString.gsub("\\n", "\n")
"a\\nb"
obviously i want to get "a\nb" (from "a\\nb"). How I am supposed to do that?
thank you,
emmanuel
definitely a very newbie question... i have strings, possibly with
carriage returns in my application, and i want to save them with '\n' in
litteral in my file (so that i'm guaranteed this string is on at most one
line), and then get back "\n" when deserializing.
But i don't quite get it for the deserialization part:
irb(main):001:0> myString = 'a\nb'
"a\\nb"
irb(main):002:0> myString.gsub('\n', "\n")
"a\\nb"
irb(main):003:0> myString.gsub("\\n", "\n")
"a\\nb"
obviously i want to get "a\nb" (from "a\\nb"). How I am supposed to do that?
thank you,
emmanuel