我的问题是 System.getProperty("line.separator")
和 Android 网络操作的 "\n"
是否相同。
我的意思是说。我将从某些服务器获得行分隔的响应,因此使用 System.getProperty("line.separator")
或 "\n"
哪个更好?
引用 Carriage returns/line breaks with \n in strings in Android但仍然不确定网络操作。
最佳答案
如果您得到行分隔的响应,请使用 BufferedReader.readLine()
读取每一行,然后如果您想要使用 System.getProperty("line.separator")
将换行符插入字符串中。
关于java - System.getProperty ("line.separator") 与 Android 的 "\n",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12987451/