System.getProperty(“line.separator”)和Android“\n”

时间:2021-05-16 23:05:14

My query is whether System.getProperty("line.separator") and "\n" for Android network operations are same. I mean to say. I will be getting line separated response from some server and so which is better to use System.getProperty("line.separator") or "\n"?

我的查询是Android网络操作的System.getProperty(“line.separator”)和“\n”是否相同。我的意思是说。我将从某些服务器获得行分离的响应,所以使用System.getProperty(“line.separator”)还是“\n”更好?

reffred Carriage returns/line breaks with \n in strings in Android but still not sure with network operations.

在Android中,reffred回车/换行与\n在字符串中分开,但仍然不能确定网络操作。

1 个解决方案

#1


9  

If you get line separated responses use BufferedReader.readLine() to read each line and then use System.getProperty("line.separator") if you want to insert the newline back into the String.

如果要将换行符重新插入到字符串中,则使用BufferedReader.readLine()来读取每一行,然后使用System.getProperty(“line.separator”)。

#1


9  

If you get line separated responses use BufferedReader.readLine() to read each line and then use System.getProperty("line.separator") if you want to insert the newline back into the String.

如果要将换行符重新插入到字符串中,则使用BufferedReader.readLine()来读取每一行,然后使用System.getProperty(“line.separator”)。