• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiline Strings

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I just wanted to know whether is it possible to have a multiline String with the end quote in a saperate line.

String j = "Multiline
String
Like this";
Thank you very much. (with out the concatanation)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you can put new-lines into Strings. Get the platform-dependent new-line String from line.separator. Add this into the String at the desired places.



People do use "\n" for new-line, but that's not strictly portable.
 
David Han
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good!I see. Thanks,Peter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic