I would split string to an array on the char 10 then join the array to string with combination char 13 & char 10 as separator.