这俩系统的文本文件中换行符不一样啊,格式没法看不利于我研究代码,求解决。
我的系统是windows。
一定要用JavaScript来弄.......
------解决方案--------------------
- JScript code
var contents = readInFile(); // 读入文件
var newcontents = contents.replace("\n", "\r\n");
saveTo(newcontents, newfile); // 写文件
------解决方案--------------------
var newcontents = contents.replace(/\r?\n/g, "\r\n");