【发布时间】:2022-10-14 00:52:28
【问题描述】:
我有一个包含类似文本的文本文件(我将\n 作为新行的指示符,因此它不存在于文本中):
\n
---
\n
\n
not fixed
number of
lines
\n
\n
---
Other text
More text
...
三行之间的文字不是固定的,那里可能有很多行文字。 我想删除三行内和顶部的所有新行:
---
not fixed
number of
lines
---
Other text
More text
...
目前我找到了如何删除第一行,但我正在努力思考如何省略其余部分:
myText = myText.split('\n').slice(1).join('\n'));
【问题讨论】:
标签: javascript node.js