FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

java help:

 


anmol
ive to insert a new line character between 2 strings . how to do this?

ie String data="1st string"+"new line char"+"2nd String";

how to insert this new line char ?
rohan2kool
I think this shall work:

Code:

String data = "String 1" + "\n" + "String 2";
martindecorte
As far as I know, if you want a portable solution, you'd better add an \r and an \r character to end your line. That is, the following line would be better :
Code:
String data = "String 1" + "\r\n" + "String 2";
AftershockVibe
Just to clarify the above. Windows uses "\r\n" - Carriage return, line feed whereas Unix based systems use just "\n" - line feed - to denote a new line.

In case you're wondering where the names come from think of how typewriters used to work. Carriage return was the pulling back of the moving cylinder which held the paper (carriage!) so the print hit the left hand side of the paper again and the line feed was turning the handle to feed more paper through.

Cool
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.