Number of items

Mark Waddingham mark at livecode.com
Mon Oct 25 11:41:38 EDT 2021


On 2021-10-25 16:22, Paul Dupuis via use-livecode wrote:
> Why is it a feature? (I'm sorry, I am sure it has been explained
> before in these lists)

Its a fundamental rule in the way xTalk string lists work.

It is neither a bug nor a feature - it is a rule - much like xTalks are 
one-based rather than zero-based for indexing.

> I searched the Quality Center and could find no open bug entry for
> this. As LC 9.6.3 still gives and item count of ",1" as 2 and an item
> count of "1," as 1 that this is indeed the expected behavior?!?

There is no bug about it because it is not a bug.

> I would have personally expected them both to be 2, but perhaps these
> is a reason trailing empty items are not counted?

Trailing delimiters in LiveCode (xTalk) string lists are ignored. If you 
want to express an empty last item in a string list you have to append 
an extra delimiter. i.e.

   the number of items in "" == 0
   the number of items in "," == 1
   the number of items in ",," == 2

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list