我的方法 System.getProperty("line.separator")
在 Apache 服务器中不起作用,但似乎在本地 Eclipse 中起作用。
实际执行
str2=str1.replace(System.getProperty("line.separator"), "CH(50)");
该代码在 eclipse 中有效,但在服务器中无效,并且“line.separator 未被 CH(50) 替换。
最佳答案
line.seperator : 操作系统用来分隔文本文件行的序列
System.getProperty("line.seperator")
依赖于操作系统。
你的服务器可能是Linux,你在windows本地测试
关于Java System.getProperty ("line.separator") 在 apache 服务器中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13414865/