dimanche 22 février 2015

Java Library to truncate html strings?

I need to truncate html string that was already sanitized by my app before storing in DB & contains only links, images & formatting tags. But while presenting to users, it need to be truncated for presenting an overview of content.


So I need to abbreviate html strings in java such that



<img src="http://ift.tt/17w3Wjo" />
<br/><a href="http://ift.tt/17w3Wjo" />


when truncated does not return something like this



<img src="http://ift.tt/17w3Wjo" />
<br/><a href="htt


but instead returns



<img src="http://ift.tt/17w3Wjo" />
<br/>

Aucun commentaire:

Enregistrer un commentaire