> On Oct 14, 2015, at 2:40 PM, Dr. Hawkins <[email protected]> wrote:
>
> On Wed, Oct 14, 2015 at 1:19 PM, Devin Asay <[email protected]> wrote:
>
>> Shouldn’t there be a way to force a string comparison? I know LC tries to
>> be all helpful about casting numerals as numbers, but what if I want to
>> know if it’s the exact string?
>>
>
> if (space & field "Display" ) = (space & someValue) then . . .
Believe it or not, when field “display” contains “0.”, the following evaluates
to TRUE:
if (space & fld “display”) = (space & “0”) then … # TRUE!
And even:
if (space & fld "display" & space) = (space & "0" & space) then … # TRUE
AGAIN!
It’s the space that’s the problem. Any other character seems to do the trick:
if ("!" & fld "display") = ("!" & "0”) then … # FALSE
Try explaining that to newbies. “Oh, I’m just coercing LiveCode to cast the
field contents as a string instead of a number.”
Blank stares and crickets… :)
Devin
Devin Asay
Office of Digital Humanities
Brigham Young University
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode