Re: How do you check the equivalency of references?
Re: How do you check the equivalency of references?
- Subject: Re: How do you check the equivalency of references?
- From: Arthur J Knapp <email@hidden>
- Date: Tue, 07 Aug 2001 18:04:20 -0400
>
Date: 7 Aug 2001 13:06:36 -0400
>
Subject: Re: How do you check the equivalency of references?
>
From: "Anthony Adachi" <email@hidden>
>
I've searched the applescript mailing lists for threads on the 32k limit of
>
strings. While I've found much on how to munge strings of that length I'm
>
having a hard time finding anything on how to compare strings that reach
>
those limits.
-- Very quickly thrown together, so please check my work:
property kStringCompareLimit : 32000
to StringsAreEqual(strA, strB) --> true/false
set {lenA, lenB} to {strA's length, strB's length}
if lenA is not lenB then
return false -- unequal lengths, not same
else if lenA < kStringCompareLimit then
return strA = strB
end if
set x to 1
repeat (lenA div kStringCompareLimit) times
if strA's text x thru (x + kStringCompareLimit - 1) = ,
strB's text x thru (x + kStringCompareLimit - 1) then
set x to x + kStringCompareLimit
else
return false
end if
end repeat
if x > lenA then -- testing complete
return true
end if
if strA's text x thru -1 = strB's text x thru -1 then
return true
else
return false
end if
end StringsAreEqual
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://homepage.mac.com/richard23/