Counting Chars by ASCI Values

Mark Smith mark at maseurope.net
Wed Mar 1 15:35:20 EST 2006


In this case, we're counting delimiters - not items, so it I'm sure  
it should be the number of items -1, unless we have a trailing  
delimiter, when the item count and delimiter count are the same,  
hence the need for "& null" or testing the last char.

This is how it seems to work on my setup (rev 2.7, Mac OS X):

1,2,3 = 3 items, 2 delimiters
,1,2,3 = 4 items (one empty), 3 delimiters
1,2,3, = 3 items, 3 delimiters - Rev doesn't count the implied empy  
item at the end.


Cheers,

Mark


On 1 Mar 2006, at 20:12, Jim Ault wrote:

>> Also, shouldn't the count be
>> 'the number of items in textStr -1?
> As I indicated in a previous post, it depends on what you are  
> trying to
> count when you use items a measure.
>
> If the last char of a string is the asciiChar, then the number of  
> items will
> be one less than the true count, however, if null is appended, the  
> count
> will be equal to the true count.




More information about the use-livecode mailing list