如何使用linebreak将字符串导出到文本文件? AngularJS

问题描述 投票:0回答:1

我导入像这个enter image description here这样的文本文件时有功能

日期将格式化为此enter image description here,它将自动导出包含新格式化日期的记事本

但事情是断线不工作新出口的记事本就像这个enter image description here

我的字符串代码是

   var fileText = $scope.list[0]+"\n"
      +$scope.list[1]+"\n"
      +$scope.list[2]+"\n"
      +$scope.list[3]+"\n"
      +$scope.list[4]+"\n"
      +$scope.list[5]+"\n"
      +$scope.list[6]+"\n"
      +$scope.list[7]+"\n"
      +$scope.list[8]+"\n"
      +$scope.list[9]+"\n"
      +$scope.list[10]+"\n";

有没有其他方法插入换行符?

javascript angularjs line-breaks notepad
1个回答
2
投票

尝试

'\r\n'

代替

'\n'

有关解释,请参阅here

© www.soinside.com 2019 - 2024. All rights reserved.