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 Html tag content wrapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Html tag content wrapping" Watch "Html tag content wrapping" New topic

Html tag content wrapping

seena mathew

Joined: Jun 14, 2009
Posts: 20
I am trying to wrap dynamic text based on number of characters(say for eg 5 characters in a line) in java.
So for example if the input Text is following, I need to do wrapping of text part only on
"Click me blh blah blah blah .... " and the other surrounding tags should be retained.

<b> <i><a href="" target="_blank"> Click me blh blah blah blah .... </a> </i> </b>

I have tried writing code but have ended up getting so confused that I am not aware of what i am doing also

Code snippet

Any suggestions would be of great help.

Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Something like:

String message = ...
if(the length of message is bigger than maxlength)
get the substring of message from 0 to maxlength

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I agree. Here's the link:
subject: Html tag content wrapping
It's not a secret anymore!