字符串中换行操作

974 阅读1分钟
1.字符串中识别换行符'\n'
$('#inputText').val().split('\n').join(',').replace(/\s+/g,"");
2.字符串中增加换行符
str.replace(/,/g, '\r\n');