This is disturbing!

Bob Sneidar bobsneidar at iotecdigital.com
Thu Sep 6 15:47:46 EDT 2018


Yes, but it's the kind of thing that can bite a new programmer in the butt. And the trouble with your comparison is that length("7. ") IS equal to length("6. "). So multiple comparisons have to be made. But this is an edge case I admit. I was only trying to maintain an index number for a TreeView widget, since the arrayData is not numerically indexed making sorting by order added a pain. I ended up using a datagrid anyway. 

Bob S


> On Sep 6, 2018, at 12:34 , Jim Lambert via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> Did anyone know that "6. " is equal to "6."???
> 
> It’s somewhat similar to 
> 	value(“h “) is equal to value(“h”), 
> while 
> 	“h “ is not equal to “h”.
> 
> I’m not disturbed but appreciative that the engine tries to convert both sides to numbers when doing a comparison. Just must remember that and use more “string-y” ways to compare strings as only strings.
> For example other functions can reveal the strings “6. “ and “6.” are not the same string, such as length(“6. “) is not equal to length( “6.”).
> 
> Jim Lambert



More information about the use-livecode mailing list