Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.getProperty("line.separator") Vs "\n" for Android

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"?

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

like image 492
Kalpesh Patel Avatar asked Oct 20 '12 10:10

Kalpesh Patel


1 Answers

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.

like image 157
Deepak Bala Avatar answered Oct 03 '22 10:10

Deepak Bala