JavaScript Newline Character

后端 未结 4 1447
灰色年华
灰色年华 2020-12-29 04:10

From this question, this ...

lines = foo.value.split(/\\r\\n|\\r|\\n/);

is one way to split a string, but how do I join it back with newlin

4条回答
  •  有刺的猬
    2020-12-29 04:22

    As said, join is the best, but here is the hard way (untested, I hope it's not too trivial):

    var result;
    
    for (i=0;i

提交回复
热议问题