• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help: how to cut html strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Help: how to cut html strings (From: Amedeo Mantica <email@hidden>)
 >Re: Help: how to cut html strings (From: Dev WO <email@hidden>)
 >Re: Help: how to cut html strings (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: Help: how to cut html strings
  • Next by Date: Laszlo to support DHTML
  • Previous by thread: Re: Help: how to cut html strings
  • Next by thread: Laszlo to support DHTML
  • Index(es):
    • Date
    • Thread