[thelist] [ColdFusion] parsing text
Mark M
mark at safefrombees.com
Thu Jul 1 17:50:06 CDT 2004
Also nothing stoping you from hooking into the java.util.StrikTokenizer class.
Mark
------------------------------------------------------------------
E: mark at safefrombees.com
W: www.compoundtheory.com
ICQ: 3094740
Quoting Scott Brady <evolt at scottbrady.net>:
> Original Message:
> > From: "Kyle Murphy"
>
> > =============STAMP: 2004/06/23 14:54:45 MATTHEW
> > I just called and Confirmed Jane Smiling with Teresa on the 4th.
> >
> > =============STAMP: 2004/06/22 15:33:37 MATTHEW
> > Teresa had already filled the need that Denise just called in.
>
> > NoteDate Note
> > ---------------- ---------
> > 2004/06/23 14:54:45 I just called and Confirmed Jane Smiling with
> > Teresa on the 4th.
> > 2004/06/22 15:33:37 Teresa had already filled the need that Denise
> > just called in.
>
> Off the top of my head:
>
> This is essentially a "list" with "==========STAMP:" as the delimiter [above,
> there are two elements to the list]. Since I don't think you can actually
> use that string as the delimiter in a CF list, I'd say replace that string
> with a single character you know won't be anywhere else in the text. I'd
> probably use the "|", but that's not guaranteed to not be there. Assuming
> you know that won't be in there, I'd first do a:
>
> ReplaceNoCase(yourString,"=============STAMP:","|","ALL")
>
> You can then loop over your test, treating as a list with | as the
> delimiter:
>
> <cfloop list="#yourString#" delimiters="|" index="i">
>
> Now, each element in that list is ALSO a list delimited by spaces. The first
> two elements are the date, you ignore the 3rd element, and then rest of the
> elements starting with the 4th are the actual note.
>
> So, to get those:
>
> <cfset noteDate = ListGetAt(i,1," ") & " " ListGetAt(i,2," ")>
> <!--- This one is trickier,basically, delete the first 3 elements --->
> <cfset theNote = i>
> <cfloop from="1" to="3" index="j">
> <cfset theNote = ListDeleteAt(theNote,1," ")>
> </cfloop>
>
> That gives you the individual notes. Here's my code all in one block (no
> guarantee it works, as is, but it should):
>
> NoteDate Note<br />
> ---------------- ---------<br />
> <cfset yourString =
> ReplaceNoCase(yourString,"=============STAMP:","|","ALL")>
> <cfloop list="#yourString#" delimiters="|" index="i">
> <cfset noteDate = ListGetAt(i,1," ") & " " ListGetAt(i,2," ")>
> <cfset theNote = i>
> <cfloop from="1" to="3" index="j">
> <cfset theNote = ListDeleteAt(theNote,1," ")>
> </cfloop>
> <cfoutput>
> #variables.noteDate# #variables.theNote#<br />
> </cfoutput>
> </cfloop>
>
> ----------------------------
> Scott Brady
> http://www.scottbrady.net/
>
>
> --
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
>
>
More information about the thelist
mailing list