"bite a new programmer in the butt" . . . well, as a person who was a new programmer in 1975 and found things very difficult to understand at first (FORTRAN IV) I certainly don't remember having a sore bottom!

I do know, that is numerical calculations empty spaces are exactly that: empty space.

While in string variables empty spaces are text.

The problem might arrise because LiveCode seems not to differentiate (on the surface at least) between
numerical variable and string variables.

Richmond.

On 6/9/2018 10:47 pm, Bob Sneidar via use-livecode wrote:
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@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
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to