Deleting 1 line from a long list

Igor Couto igor at pixelmedia.com.au
Tue Oct 21 21:10:03 EDT 2003


Thank you for all who replied with the EXCELLENT suggestions:

On Tuesday, October 21, 2003, at 07:11  PM, Jan Schenkel wrote:

> Try the following :
>
> function fDeleteLine pList,pString
>   if pList is empty then return empty
>   if pString is empty then return pList
>   set the wholeMatches to true
>   put lineOffset(pString, pList) into tOffset
>   return line 1 to (tOffset - 1) of pList & \
>      return & line (tOffset + 1) to -1 of pList
> end fDeleteLine
>

On Tuesday, October 21, 2003, at 07:27  PM, Cubist at aol.com wrote:

>    Don't bother with a repeat loop at all.
>
> function fDeleteLine pList,pString
>     if pList is empty then return empty
>     if pString is empty then return pList
>     put offset ((return & pString & return),(return & pList & return)) 
> into
> Fred
>     if Fred = 0 then
>         # pString isn't in pList at all
>         return empty
>     else
>         put the number of lines in char 1 to Fred of pList into George
>         delete line George of pList
>         return pList
>     end if
> end fDeleteLine


On Tuesday, October 21, 2003, at 07:20  PM, xbury.cs at clearstream.com 
wrote:

> By far the fastest should be this though:
> If you can predict what the line will be you can also use a replace (
> thisstring & CR) with "" in mylist.
> The other choice is to use the regular expression if your guess is not
> exact but grepable...

I'm going to try the 3 out, and see if one is any faster/easier to 
maintain than the others!

Many, many thanks!

Kindest Regards,
--
Igor de Oliveira Couto
----------------------------------
----------------------------------


More information about the use-livecode mailing list