Re: Reading a file into a "sequence"...correction

new topic     » topic index » view thread      » older message » newer message

John F Dutcher wrote:
> 
> Sorry about the question over the line[1..4] = "%HDR" issue....
> it needed to say line[2..5] of course.....
> That just leaves being able to treat the values in line as
> members of a "sequence".......
>
> > *********************   file sampling  ************
> > "%HDR","EXTRACT","11/17/2004 02:23:10 AM","UNIVERSITY OF ROCHESTER MEDICAL
> > CENTER"
> >
> > "%DTL","000061474714","000001821707","BARNES","CHARLES","","03/31/2001","03/20/2001","03/20/2001","000001819.00","000000000.00","11/07/2004","E3R","000001819.00","A1O","
> >   ","86115","YJP115341192","     ","10549",,,,,,,"86","EMG ","C"," "
> >
> > "%DTL","000079336343","000002008157","FRANCIS","DALE","","11/13/2004","09/19/2002","09/19/2002","000002198.00","000000000.00","11/01/2004","09","000000408.00","A1O","
> >   ","50102","132288832A","     ","02262",,,,,,,"50","BMT ","C"," "
> >
> > "%DTL","000079336343","000002008157","FRANCIS","DALE","","11/13/2004","09/19/2002","09/19/2002","000002198.00","000000000.00","11/03/2004","17","000000408.00","A1O","
> >   ","50102","132288832A","     ","02262",,,,,,,"50","BMT ","C"," "
> >
> 

Here's a solution (assuming that the lines were split by the forum):

items = value("{" & gets(fn) & "}")
items = items[2]

...would read a line, add braces around it, and then give it to value(),
which reads a string representation of a euphoria object.
It will then get the second element of the returned sequence,
which is the euphoria sequence (the first element is error status).
Your lines will be valid representation of euphoria sequences if you just
put braces around each of them.

Regards, Alexander Toresson

Shhh! Be vewy quiet! I'm hunting wuntime ewwows!

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu