function transferString(content) { var string = content; try{ string=string.replace(/\r\n/g," ") string=string.replace(/\n/g," "); }catch(e) { alert(e.message); } return string; } var str = transferString('sdfafda↵dfafafdsaf');
console.log(str);
本文共 396 字,大约阅读时间需要 1 分钟。
function transferString(content) { var string = content; try{ string=string.replace(/\r\n/g," ") string=string.replace(/\n/g," "); }catch(e) { alert(e.message); } return string; } var str = transferString('sdfafda↵dfafafdsaf');
console.log(str);
转载于:https://www.cnblogs.com/undefined-h/p/8046416.html