File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help me with: String manipulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help me with: String manipulation" Watch "Help me with: String manipulation" New topic

Help me with: String manipulation

kris reddy

Joined: Nov 07, 2000
Posts: 19
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.

Kris Lee
Jason Ford
Ranch Hand

Joined: Aug 02, 2001
Posts: 54
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

Joined: May 24, 2002
Posts: 104
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?

Tom Purl<br />SCJP 1.4
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
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.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: Help me with: String manipulation
It's not a secret anymore!