From: "A. Mcbomb" Date: 2010-12-14T07:30:55+09:00 Subject: Re: Substituting New Line Character thanks Jeremy, that helped me figure out what I was doing wrong. I appreciate it! atomic Jeremy Bopp wrote in post #968136: > On 12/13/2010 02:14 PM, A. Mcbomb wrote: >> >> For "carriage return", I have tried using \r and \n but it puts those in >> literally and does not force a carriage return when I open up the file >> in VI. >> >> It seems like \n and \r are not working in this case. > > They do work actually: > > irb(main):001:0> a = "hello world" > => "hello world" > irb(main):002:0> a.gsub!(" ", "\n") > => "hello\nworld" > irb(main):003:0> puts a > hello > world > => nil > > As you can see, the string gets the newline character inserted in place > of the space character in this example. > > Can you reproduce this problem with a trivial example? I suspect that > if you try that you might find the problem. What's going wrong is not > readily apparent to me with the information available. > > -Jeremy -- Posted via http://www.ruby-forum.com/.