This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Html tag content wrapping" Watch "Html tag content wrapping" New topic
Author

Html tag content wrapping

seena mathew
Greenhorn

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="http://www.google.com" 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.
 
Consider Paul's rocket mass heater.
 
subject: Html tag content wrapping
 
Similar Threads
June Newsletter Puzzle
Pass a StringBuffer to a method
Formatting tooltips
Delimiting Strings
Scrambling Words