FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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
Related topics
JAva HELP
Does anypne help me about JAVA on UNIX?
Java Help
java help:how does dynamic instantiation of classess happen?
I need a javascript!!! Help!
Help with php and java script
JAVA hElp
java help
Java Help
java help
[Java] Wanna help me figure out this error?
Help needed for making a server in java....
Constructors in Java, help
java help pls!
Reply to topic    Frihost Forum Index -> Scripting -> Others

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