Question

We can certainly do it by

string.chomp+"\r\n"

but I'm wondering is there an elegant way to do it.

Was it helpful?

Solution

Not that I'm aware of.

This prior answer seems to suggest use of gsub (regex replacement)

Normalizing line endings in Ruby

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top