Here’s how I would do it:

for n=1 to 60

for x=len(t$(n)) to 1 step -1

if mid$(t$(n),x,1)=";" then t$(n)=left$(t$(n),x-1) : print t$(n) : EXIT FOR

next x

next n

Lorne Russell

From: paradisejb

Sent: Tuesday, July 02, 2013 8:36 AM

To:

libertybasic@yahoogroups.com
Subject: [libertybasic] Re: tickets

Here's a way to strip the last digits from the tickets. It can be added to the end of Rod's code.

for n= 1 to 60

l=len(t$(n))

while right$(t$(n),1)<>";"

l=l-1

t$(n)=left$(t$(n),l)

wend

print left$(t$(n),l-1)

next n

--- In mailto:libertybasic%40yahoogroups.com, "Rod" <rodbird@...> wrote:

>

> This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going on.

>

> 'create some dummy data with raising number 1-99

> open "ticket.csv" for output as #1

> for n= 1 to 99

> print #1, "06/04/2013;1;10;18;21;31;"+str$(n)+";11"

> next

> close #1

>

> 'count number of tickets

> open "ticket.csv" for input as #1

> while not(eof(#1))

> line input #1, nul$

> i=i+1

> wend

> close #1

>

> 'discard the ones you dont want

> open "ticket.csv" for input as #1

> for n= 1 to i-60

> line input #1, nul$

> next

>

> 'grab the ones you do

> dim t$(60)

> for n = 60 to 1 step -1

> line input #1, t$(n)

> next

>

> for n= 1 to 60

> print t$(n)

> next

>

>

>

> --- In mailto:libertybasic%40yahoogroups.com, "jurgen" <dovejurgen@> wrote:

> >

> > Thanks green8819

> > I shall see if I can use it .

> > What I wanted was to read a list with all the tickets from the lottery

> > Here it's named LottoGameData.csv

> > I want to print only the last 60 tickets without bonus nr because then I can load this in my program.

> >

> > example original line

> > 06/04/2013;1;10;18;21;31;37;11

> >

> > What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away

> >

> > example:

> >

> > T$(60) = " 01 10 18 21 31 37"

> >

>

[Non-text portions of this message have been removed]