A string doesn't equal itself - simple workaround

Jim Ault JimAultWins at yahoo.com
Sun Apr 8 02:15:28 EDT 2007


Workaround
On 4/7/07 7:57 PM, "J. Landman Gay" <jacque at hyperactivesw.com> wrote:

> Bizarre. Get this:
> 
>    put "09114E715806" = "09114E715806"
> 
> returns false.
> 
> Is it interpreting this string as a number with an exponent? Something
> about math libraries?

false:
  put char 1 to -1 of ("09114"&"e"&"715806") =  \
         char 1 to -1 of ("09114e7"&"15806")

true:
  put char 1 to -1 of ("09114"&"eA"&"715806") =  \
         char 1 to -1 of ("09114eA7"&"15806")

Also true:
put "09114e715806"&null =  "09114e715806"&null

Looks like another case where appending null is an answer to workaround
xtalk oddities where one programmers feature is another's gotcha.

Another example of a good use of Null

repeat with x = 1 to the number of lines in (fld havingEmptyLastLine & null)
put the number of items of (gInventory & null) into maxCount

Jim Ault
Las Vegas





More information about the use-livecode mailing list