How to split a string into multiple lines of x characters
807601Dec 14 2007 — edited Dec 17 2007Hi
I want to split a string into multiple lines of 'x' characters without breaking a word. That is, for example, if x = 13, if the 13th character falls in the middle of a word, this word should not be considered for the first line, but must go into the next line.
Example:
If the string is "*The quick fox jumped over a lazy dog*", and I want to break this into multiple line of 13 characters, it should be like this:
The quick fox
jumped over a
lazy dog
How can I achieve this in java?
Thanks
J