JS字符串分割/r/n

933 阅读1分钟
let str = 'one\r\ntwo\r\nthree' ;
let splitArr = str.split(/[\r\n]+/);
console.log(splitArr); // ["one", "two", "three"]