selecting ALL lines in list field

Jan Schenkel janschenkel at yahoo.com
Sun May 19 05:08:01 EDT 2002


--- Terry Vogelaar <terry at discovery.nl> wrote:
> >> select line 1 to -1 of field myField
> > 
> > Thanks!  That works fine with no repeats.  I'm not
> sure how it works. I
> > don't really understand it.  But thanks!
> 
> Well, -1 means "last". You can use this in several
> other ways. Like when you
> want to remove the 3-character-extension of a file
> name, you can type:
> 
> delete char -4 to -1 of "filename.jpg"
> 

Like Terry said, {line -1} is the same as {the last
line}. Perhaps it's easier to look at it this the
'calculus' way:
- when you're using positive numbers, you start from 0
and go to the right.
- negative numbers actually start at the other end,
and work their way to the left.

In the case above, we could also have replaced your
script with

   put the number of lines of field myField into lLast
   select line 1 to lLast of field myField

or if you like convoluted scripts

   select line 1 to (the number of lines of field \
   myField) of field myField

which would have been the 'HyperCard' way to do it.

Best regards,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (De Rochefoucald)

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the use-livecode mailing list