How do i remove empty lines from a string? I have tried some_string = some_string.gsub(/^$/, \"\");
and much more, but nothing works.
Replace multiple newlines with a single one:
fixedstr = str.gsub(/\n\n+/, "\n")
or
str.gsub!(/\n\n+/, "\n")