Just a first swag, but how about something like....
<cfset MyString = "your big giant string" />
<cfset CharCount = 0 />
<cfset NewString = "" />
<cfloop list=#MyString# index="i" delimiters=" ">
<cfif CharCount + Len(i) LTE 250>
<cfset CharCount = CharCount + Len(i) />
<cfset NewString = ListAppend(NewString,i," ") />
<cfelse>
<cfbreak />
</cfif>
</cfloop>
On 1/25/07, Colin Wilson <[EMAIL PROTECTED]> wrote:
Looking for a suggested resource where I might find how to trim a string
to a certain length, but not chop the words..
such that it would be say 250characters, but then go back to the last
space.
I was thinking of just a rtrim, but wasn't sure if there was a better way?
Thanks
Colin
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.10/651 - Release Date: 1/24/2007
6:48 PM
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/
--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
Where's your Spot?
www.instantspot.com
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/