Very basically:

<cfset sentenceCutoff = 3>
<cfset delimiter = ".">
<cfset nSentences = ListLen(copy, delimiter)>

<cfloop from=1 to=#Min(sentenceCutoff, nSentences)# index=i>
        <cfoutput>#ListGetAt(copy, i, delimiter)##delimiter#</cfoutput>
</cfloop>

Steve


> -----Original Message-----
> From: Ian Westbrook [mailto:[EMAIL PROTECTED]
> Sent: 25 July 2003 16:38
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] truncating section of text...
> 
> 
> I've got this far:
> 
> <cfloop index="d" list="#copy#" delimiters=".">
> #d#
> </cfloop>
> 
> but of course that outputs the whole list (ie the whole news item).
> 
> I've tried from="1" to="3"
> 
> and I've tried endrow="3"
> 
> but both methods throw an error.
> 
> any ideas?
> 
> Ian W
> 
> 
> 
> 
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, July 25, 2003 4:20 PM
> Subject: Re: [ cf-dev ] truncating section of text...
> 
> 
> >
> > you could treat the text as a list, with the fullstop as 
> the delimiter.
> > loop through the list 3 times.  if the list length is > 3, 
> then it's been
> > truncated.
> >
> >
> > Duncan Cumming
> > IT Manager
> >
> > http://www.alienationdesign.co.uk
> > mailto:[EMAIL PROTECTED]
> > Tel: 0141 575 9700
> > Fax: 0141 575 9600
> >
> > Creative solutions in a technical world
> >
> > 
> ----------------------------------------------------------------------
> > Get your domain names online from:
> > http://www.alienationdomains.co.uk
> > Reseller options available!
> > 
> ----------------------------------------------------------------------
> > 
> ----------------------------------------------------------------------
> >
> >
> >
> >                     "Ian
> >                     Westbrook"           To:     "cfug dev list"
> <[EMAIL PROTECTED]>
> >                     <[EMAIL PROTECTED]        cc:
> >                     eam.net>             Subject:     [ cf-dev ]
> truncating section of text...
> >
> >                     25/07/2003
> 
> >                     16:14
> >                     Please
> >                     respond to
> >                     dev
> >
> >
> >
> >
> >
> > Hi
> > I have a 'news' table featuring, er, news stories about arts
> organisations.
> > I'd like to pull one at random and feature it on the front 
> page of the
> > site. I've managed that no problem. But some of the news 
> items are rather
> > long, and what I'd like to do is just feature the first two or three
> > sentences.
> >
> > so is there any way (regex?) of truncating the text at the 
> third full
> stop;
> > and is there anyway of knowing whether this is _all_ the 
> text or whether
> > there is more that has been truncated? I'd like to output one of two
> links:
> >
> > 'read the rest of this news item' if there is more text 
> which has been
> > truncated out, or
> > 'read more news stories' if in fact the three sentences 
> that appear was
> the
> > whole news item.
> >
> > anyone any ideas?
> >
> > TIA
> >
> > Ian W
> >
> > Ian Westbrook,
> > FutureDream Media Limited,
> > (W): www.futuredream.net
> > (E): [EMAIL PROTECTED]
> > (T): +44 (0) 1303 258 985
> > (M): 07939 510 812
> >
> > This message may contain information which is legally 
> privileged and/or
> > confidential. If you are not the intended recipient, you are hereby
> > notified that any unauthorised disclosure, copying, 
> distribution or use of
> > this information is strictly prohibited. Such notification 
> notwithstanding
> > any comments, opinions, information or conclusions expressed in this
> > message are those of the originator, not of FutureDream 
> Media Ltd, unless
> > otherwise explicitly and independently indicated by an authorised
> > representative of FutureDream Media Ltd.
> >
> >
> >
> >
> >
> > --
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > For human help, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> 

--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to