Tom,

Thanks for the idea, but I am stuck with CF 4.0.1 at the moment.  However
won't your function just insert at the 70th character regardless of whether
is falls within a word?  What I am trying to do is a "friendly" line break.
Never breaking into a word unless the word is over 60-70 characters long,
which is not likely.


Best regards,

Dennis Powers
UXB Internet
(203)879-2844
http://www.uxbinfo.com/

-----Original Message-----
From: tom muck [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 12:15 PM
To: CF-Talk
Subject: Re: Formatting Text for Email/Text Files

Here's a function for CF 5:

 call it like <cfset mybody = makeNiceEmail(mybody,70)>

<cfscript>
function makeNiceEmail(string, theLength) {
 CRLF=chr(13);
 for (i=theLength-1;i LTE Len(string);i=i+theLength){
   string = Insert(CRLF,string,i);
 }
 return string;
}
</cfscript>

tom
www.basic-ultradev.com

"Dennis Powers" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> It has been a long working weekend and my brain is suitably befuddled at
the
> moment.  I am attempting to format text for use in an email or a RAW text
> file and wish to insert a carriage return/line feed at the closest space,
> with out breaking the words, to the 60-70 characters point for each line.
>
> I am pulling text data out of a database that only has CR/LF breaks at the
> paragraph level. The paragraphs can run several hundreds words (don't
ask -
> it's PhD speak stuff) I need to create text files from the data with CR/LF
> breaks inserted within the paragraphs to break at a space within the
> 60-70-character point.
>
> I am sure someone has done this before and am hoping that you might be
> willing to take pity on one of your fellow CF'ers and share some code.
>
>
> Best regards,
>
> Dennis Powers
> UXB Internet
> (203)879-2844
> http://www.uxbinfo.com/
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to