Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me with: String manipulation

 
kris reddy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know if more than one line can be present in a String. Is so plz gimme an example.
I would really appreciate your help.
Thanks,
Kris.
 
Jason Ford
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean like this?

For i18n, you may need to replace the "\n" with "\r\n". The "\n" represents the newline character.
BTW - You'll need to take the underscore out of your name and add a space in its place. There aren't many rules around here, but the naming policy is one of them. It looks like you've gotten by this long, though.
 
Tom Purl
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an example:

In the example above, I've taken a series of strings and concatenated them using the "+" operator. Is this what you mean by "more than one line in a String"? Also, I added the carriage-return escape character (\n) to the String. If you were to send this String to your screen, it would look like this:
I would like to know if more than one line can be present in a String.
Is so plz gimme an example.
Is that what you meant by having mulitple lines?
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kris_reddy,
An underscore in your name is not the same as a space. We'd like you to read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic