Skip to main content
added 1 character in body
Source Link
Conor Cosnett
  • 7.7k
  • 1
  • 24
  • 47

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"4";

enter image description here

such that the output is

"line 1\nline 3\nline 4"

enter image description here

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"

enter image description here

such that the output is

"line 1\nline 3\nline 4"

enter image description here

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";

enter image description here

such that the output is

"line 1\nline 3\nline 4"

enter image description here

Source Link
Conor Cosnett
  • 7.7k
  • 1
  • 24
  • 47

how to delete the nth line in a multiline string?

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"

enter image description here

such that the output is

"line 1\nline 3\nline 4"

enter image description here