How in node to split string by newline ('\n')?

后端 未结 7 1831
南笙
南笙 2020-11-29 17:30

How in node to split string by newline (\'\\n\') ? I have simple string like var a = \"test.js\\nagain.js\" and I need to get [\"test.js\", \"again.js\"]<

相关标签:
7条回答
  • 2020-11-29 18:32

    I made an eol module for working with line endings in node or browsers. It has a split method like

    var lines = eol.split(text)
    
    0 讨论(0)
提交回复
热议问题