Hi, I’m new to ruby, and am having trouble with the following (\n is
newline on a Mac).
line = “foo bar”
line = line.sub(/ /, ‘\n’)
when what I want (and expected) was:
(This is just a toy example; I don’t actually want to split lines on
spaces.) What I don’t understand is how to insert a true newline into a
string so that it outputs as such.