Re: Help: how to cut html strings
Re: Help: how to cut html strings
- Subject: Re: Help: how to cut html strings
- From: Dev WO <email@hidden>
- Date: Tue, 23 May 2006 15:01:44 +0200
Hello Mike,
no problem, go for it;)
actually I never took the time to make another one which would
concatenate but keeping the HTML, so it would have to detect if the
end is in the middle of a tag, etc
Xavier
That's Wikibook "Development/Tips and Tricks" material if I ever
saw it :)
On May 23, 2006, at 5:23 AM, Dev WO wrote:
Hello Amedeo,
here's what I've done on my side, assuming I don't want any word
to be cropped but you can remove this part:
you will need:
import org.apache.commons.lang.*; //From Apache
import org.clapper.util.text.*; // From http://www.clapper.org/
public static String stripHTMLTagsAndConcatenate(String
htmlString, int numberOfChar) {
return (StringUtils.substringBeforeLast
(StringUtils.abbreviate((HTMLUtil.stripHTMLTags(htmlString)),
numberOfChar), " ")) + "...";
}
So this is in my framework.
Hope this help
Xavier
Hello, in my application i need sometimes to display a WOString
reducing dysplayed caracthers to about 200.
I have my own class that cut the string, nut now I have this
problem...
The string that I'm goung to cut is an HTML string, simply
cutting it probably I break some closing tags therefore I got a
bad rendered html.
do you know how to cut text leaving tags uncutted?
obviously my WOString have HTMLespace binding setted to false.
thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anazys.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anazys.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden