This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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
jQuery in Action, 3rd edition