【问题标题】:Java System.getProperty("line.separator") not working in apache serverJava System.getProperty("line.separator") 在 apache 服务器中不起作用
【发布时间】:2012-11-05 01:50:19
【问题描述】:

我的方法System.getProperty("line.separator")Apache 服务器中不起作用,但似乎在本地Eclipse 中起作用。

实际实现

str2=str1.replace(System.getProperty("line.separator"), "CH(50)");

该代码在 Eclipse 中有效,但在服务器中无效,并且“line.separator 没有被 CH(50) 替换。

【问题讨论】:

  • 你在服务器上运行什么操作系统?它和你的“eclipse”机器上的一样吗?
  • 客户端是否发送了适用于服务器的 line.separator? line.separator 是否存在?不是一个真正的问题。

标签: java regex string char system-properties


【解决方案1】:

line.seperator :操作系统用来分隔文本文件中的行的序列

System.getProperty("line.seperator") 取决于操作系统。

您的服务器可能是 Linux,您正在 Windows 中本地对其进行测试

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-31
    • 2013-10-07
    • 1970-01-01
    • 1970-01-01
    • 2014-08-19
    • 2015-03-20
    • 2016-08-16
    相关资源
    最近更新 更多