one could also

<cfset insertpoint = 50>
<cfloop on the String>

</cfloop>


On Sat, 29 Jan 2005 13:25:18 +1100, Steve Onnis <[EMAIL PROTECTED]> wrote:
> Give this ago
> Just wrote it so haven't tested it, but looks like it would work
> 
> <!--- The paragraph --->
> <cfset para = "this is some text that would be your string. the string would 
> then have a &lt;br&gt; tag inserted after ever 50th
> space. this string prolly wont be long enouhg but you try it out.">
> <!--- split the string into an array using the spaces as the deilimiter --->
> <cfset arr = listToArray(para, " ")>
> <!--- loop over the array using 50 as the step, that we wont need to loop 
> over every element --->
> <cfloop from="1" to="#arrayLen(arr)#" index="i" step="50">
>        <!--- insert a line break at the end of every 50th array element --->
>        <cfset arr[i] = arr[i] & "<br>">
> </cfloop>
> <!--- convert the array back into a string using the spaces as the delimiter 
> again --->
> <cfset str = arrayToList(arr, " ")>
> <!--- output the string --->
> <cfoutput>#str#</cfoutput>
> 
> Steve
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chad
> Sent: Saturday, January 29, 2005 10:33 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: Inserting line breaks after so many charachters
> 
> Cool, I'll have a crack.  I know what you mean.  As it is, I barely had
> time for Transformers this morning.  ;)
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Phil
> Evans
> Sent: Saturday, 29 January 2005 10:16 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: Inserting line breaks after so many charachters
> 
> Sorry chad - haven't got time to do the coding for you - if I had the
> time I wouldn't be working on a Saturday!
> 
> Check help for cfloop (Conditional loop), left(), reverse() and
> replace() functions.
> 
> HTH
> Phil.
> 
> ----- Original Message -----
> From: "Chad" <[EMAIL PROTECTED]>
> To: "CFAussie Mailing List" <[email protected]>
> Sent: Saturday, January 29, 2005 10:11 AM
> Subject: [cfaussie] Re: Inserting line breaks after so many charachters
> 
> > Thanks Phil, my fellow Saturday fellow.  So how would this look in
> > code?
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Phil
> > Evans
> > Sent: Saturday, 29 January 2005 9:30 AM
> > To: CFAussie Mailing List
> > Subject: [cfaussie] Re: Inserting line breaks after so many
> > charachters
> >
> >
> > Just a thought -
> >
> > Assuming you wanted to have the <br> at 50 characters or before, you
> > could break the string up into the chunks of 50, then for each chunk,
> > use the reverse function, then replace " " with <br> (by default does
> > only the first one), then reverse it again.
> >
> > Cheers,
> > Phil.
> >
> > ----- Original Message -----
> > From: "Chad" <[EMAIL PROTECTED]>
> > To: "CFAussie Mailing List" <[email protected]>
> > Sent: Saturday, January 29, 2005 9:23 AM
> > Subject: [cfaussie] Inserting line breaks after so many charachters
> >
> >
> > > Bit of weekend programming here...
> > >
> > > How would I go about inserting <br> into a string after so many
> > > charactrers without breaking up a word?
> > >
> > >
> > > ---
> > > You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> 
> > > To unsubscribe send a blank email to
> > [EMAIL PROTECTED]
> > > Aussie Macromedia Developers: http://lists.daemon.com.au/
> > >
> >
> >
> > ---
> > You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
> > unsubscribe send a blank email to
> > [EMAIL PROTECTED]
> > Aussie Macromedia Developers: http://lists.daemon.com.au/
> >
> >
> > ---
> > You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> > Aussie Macromedia Developers: http://lists.daemon.com.au/
> >
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
> unsubscribe send a blank email to
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
>

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to