Weird string comparison problem...

Paul Dupuis paul at researchware.com
Tue Nov 27 15:07:00 EST 2012


Using LC 5.0.2, I have a really weird string comparison error occurring.

The following code:
      put length(tActualSourceName),length(tExpectedSourceName)&cr after msg
      repeat with i=1 to the number of characters in tActualSourceName
        if char i of tActualSourceName is not char i of
tExpectedSourceName then
          put i,char i of tActualSourceName,"<>",char i of
tExpectedSourceName&cr after msg
        else
          put i,char i of tActualSourceName,"==",char i of
tExpectedSourceName&cr after msg
        end if
      end repeat
      put (tActualSourceName = tExpectedSouceName) after msg

Produces the following message window output:
13,13
1,l,==,l
2,a,==,a
3,t,==,t
4,i,==,i
5,n,==,n
6,t,==,t
7,e,==,e
8,x,==,x
9,t,==,t
10,.,==,.
11,r,==,r
12,t,==,t
13,f,==,f
false

So, if the strings are the same length and every character tests equal,
then how come the strings do not equal one another??? Anybody have any
idea???
And, yes, I did try "is" insread of "=" and "<>" instead of "is not" and
since the operators should be interchangeable, it made no difference.

-- 
Paul Dupuis
Cofounder
Researchware, Inc.
http://www.researchware.com/
http://www.twitter.com/researchware
http://www.facebook.com/researchware
http://www.linkedin.com/company/researchware-inc





More information about the use-livecode mailing list