Reputation: 19
For example, in this block:
first line of the paragraph&second sentence, should end up on the second line&third part, should end up on third line
I want the output to have each sentence start on a new line, so essentially breaking the paragraph after ever ampersand.
How can I achieve this in java?
Upvotes: 0
Views: 109
Reputation: 1373
If your paragraph follows the same ending line pattern, you can easily use String split() method which will return an array of strings(your lines). Very powerful and easy to use. Here is a basic example:
String[] lines = "Peter;James;Thomas".split(";");
Upvotes: 1