delete chunk.

Alex Tweedly alex at tweedly.net
Wed Nov 3 09:08:31 EDT 2010


On 03/11/2010 04:41, J. Landman Gay wrote:
>
> Right. You can't have an empty last item, and if you try, the last 
> delimiter is removed. There's a comment about it in the dictionary 
> under "item".
>
You can have an empty last item - see the end of the email.

But even without that special case, you can have a trailing delimiter - 
if you do this in the message box of LC 4.5

put "a,b,c" into t ; put empty into item -1 of t; put t

then you get

a,b,

i.e. the trailing comma remains.  If instead you say "delete item -1 of 
temp" then the trailing delimiter disappears.

I guess it just *is* that way, and always has been. The problem is that 
the docs are completely wrong when they say

    delete /chunk/ of /container /
is the same as
    put empty into /chunk/ of /container/


But it can be tricky to follow the logic. Here's a quiz .... without 
trying it :-) what do you get from
> put "a,b,c" into t
> put empty into the last item of t
> put empty into the last item of t
> put empty into the last item of t
> put t
answer follows below ....





















You get "a,,"
the first "put empty ..." removes "c"
The second one removes "b"
The third one does nothing - because the last item is empty.

-- Alex.





More information about the use-livecode mailing list