If you consider the variable as a list delimited with spaces you can process
it.
Here is code that I use:
<cfscript>
st="now I lay me down to sleep the Lord I pray my soul to keep If I should
die before I wake the Lord I pray my soul to take";
maxl=100;
ar=listtoarray(st," ");
outar=arraynew(1);
outst="";
for(i=1;i LE arraylen(ar);i= i +1){
 if(len(outst)+len(ar[i]) GT maxl){
  temp=arrayappend(outar,outst);
  outst="";
 }
 outst=ltrim(outst & " " & ar[i]);
}
if(len(outst)){
 temp=arrayappend(outar,outst);
}
 </cfscript>
----- Original Message -----
From: "Bill Poff" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 30, 2001 8:45 AM
Subject: How do I parse strings?


> Hello fellow CFers,
>
> I'm trying to process a "textarea" variable and break it up into lines of
> aprox 70-80 characters in length for transmission as a text formatted
email
> message.
>
> Can someone help me with the code to parse the variable into lines so that
I
> can insert a #CHR(13)##CHR(10)# at the end of every line. The challenge is
> to break between words.
>
> Thanks.
>
> --Bill
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to