just a quick question.
I wonder how many characters count for \n (new line ) in JAVA?
Because I need to fit 160 chars in one String,etc.
So.. How many chars should I consider for \n when appending to my StringBuffer?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
'\n'itself is one character when represented internally in Java, but when interfacing with external systems it can be represented by anywhere between 1 and 8 bytes. Some systems and protocols represent a newline with\r\n, which is 2 characters. And the encoding matters as well, since it can cause each character to use 1, 2, or 4 bytes.Without more information on what system or protocol the characters are going to be sent on it is not possible to give a completely accurate answer.