all these examples are a bit complex, neg?

why not use Replace to replace the multichar delimiters with a single
character one (like the bell character that Dave Watts is so fond of)
and then use list functions?

IE:

Replace(VARIABLES.journalstring, "<P><P><I>", Chr(7), "ALL")

christopher olive, cto, vp of web development
cresco technologies, inc
410.825.0383
http://www.crescotech.com


-----Original Message-----
From: Steve Oliver 
Sent: Wednesday, January 23, 2002 8:49 AM
To: CF-Talk
Subject: RE: split


I made this cfscript that does what your wanting, except it puts it into
a query :)

You can change it around I'm sure If you'd rather have an array.

<cfset string="<P><P><I>blah blah blah<P><P><I>test 2<P><P><I>test 3">


<cfscript>

entries = QueryNew("data");
entryloc = 1;

for(i=1; entryloc neq 0; i=i+1){

        QueryAddRow(entries);

        entrystart = find("<P><P><I>",string,entryloc);
        entryloc = find("<P><P><I>",string,entrystart+1);

        if(entryloc NEQ 0){
                entrylen = entryloc - (entrystart + 9);
        }else{
                entrylen = len(string) - entrystart + 9;
        }

        entrytext = mid(string,entrystart+9,entrylen);
        temp=QuerySetCell(entries,"data",entrytext);
}
</cfscript>

<!--- Output the data --->
<cfoutput query="entries">
#entries.data#<br>
</cfoutput>



-----Original Message-----
From: Brent Goldman [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 22, 2002 10:01 PM
To: CF-Talk
Subject: split


Hi everyone,

Is there any equivalent of the Perl function "split" in ColdFusion.  I
don't
think that there is, so are there any custom tags that can do something
similar?

My problem is that I need to take a string of HTML, and parse out the
date/time and text values.  Each "entry" in the "journal" string begins
with"<P><P><I>", so in Perl all I would need to do is "@entries=
split(/<P><P><I>/i, $journal);" to get an array of the entries contained
within the journal (except that the first element in the array would be
a
null string, since there is nothing before the opening <P><P><I> in the
journal.

Does anyone have a better idea of parsing the entries from the journal,
rather than using split, since it is unavailable?

Thanks
-Brent


______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to