Handling of final delimter (was Re: "this me"?)

J. Landman Gay jacque at hyperactivesw.com
Sun Aug 11 17:47:18 EDT 2013


On 8/11/13 4:30 PM, Kay C Lan wrote:
> On Fri, Aug 9, 2013 at 3:34 AM, J. Landman Gay <jacque at hyperactivesw.com>wrote:
>
>>
>> When you think of it that way, it all falls into place.
>>
>> Not really. In the Message Box:
>
> put "1,1,3,2,1,4" into tStore
> put tStore into msg
> put empty into item -1 of tStore
> put cr & tStore after msg
> put cr  & item -1 of tStore after msg
> put 7 into item -1 of tStore
> put cr & tStore after msg
>
> This is a rather big gotcha! You asked LC to create an empty item and then
> put a number into your place holder. LC deleted an item instead, which then
> mangled your data.
>
> If LC acted consistently then I'd agree that just learning that a delimiter
> followed by empty is not an item, but if that is the case then whenever you
> ask LC to create an empty item then LC should ensure there is a delimiter
> after it.

It's consistent. Empying the last item essentially deletes it. The 
terminating comma is retained because it belongs to the item before it. 
The last item beomes "1", and you replace that with 7.

The item delimiter is a terminating character, not a divider, and it 
"belongs" to the text of the item before it.

Lines are easier to grok:

This is line 1 <cr> -- cr is part of line 1
This is line 2 <cr> -- cr is part of line 2
This is line 3 <cr> -- cr is part of line 3

If I put empty into the last line, that text and its terminator are removed:

This is line 1 <cr> -- cr is part of line 1
This is line 2 <cr> -- cr is part of line 2

Here are three items:

item 1,
item 2,
item 3,

They work the same way.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list