How do I delete the $n$th line in a multi-line string.
For example how would I delete the $2$nd line in the following string?
multiLineString = "line 1\nline 2\nline 3\nline 4";
such that the output is
"line 1\nline 3\nline 4"
dropLines = StringRiffle @ Delete[ImportString @ #, #2] &;
Examples:
dropLines[multiLineString, {2}]
dropLines[multiLineString, {{1}, {3}}]
stringDeleteLine[str_, n_] := StringRiffle[Drop[StringSplit[str, "\n"] , {n}] , "\n"]
$\endgroup$