• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: comparing two identical strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comparing two identical strings


  • Subject: Re: comparing two identical strings
  • From: John W Baxter <email@hidden>
  • Date: Tue, 5 Feb 2002 12:36:15 -0800

At 20:48 -0800 2/2/2002, Paul Berkowitz wrote:
>On 2/2/02 8:31 PM, "email@hidden" <email@hidden> wrote:
>
>> I'm a newbie with Applescript, and could use some help figuring out what
>> Applescript doesn't like about the way I'm comparing variables.
>>
>> I've got 2 strings which are areacodes of a phone #:
>>
>> "display dialog x" yields:
>>
>> 703
>>
>> and "display dialog y" yields:
>>
>> 703
>>
>> I need to compare them and see if they are equal. If I do a:
>>
>> if x = y then
>> display dialog "They're equal!"
>> end if
>>
>> nothing happens. Do I need to convert these variables into something
>>else to
>> do this testing?
>
>
>Nowhere have you told us what the two strings are. What is x and what is y?
>Never mind the display dialogs. If x = 703, that's not actually a string,
>although display dialog may coerce it to one. Is
>
> x = 703
>
>and
>
> y = "703"
>
>perhaps? Then they're not equal.
>
>But (x as string) = (y as string)
>
>will be true. But it could be a completely different problem.
>
>Don't you think you'd better let us in on the secret and show us the part of
>the code that defines x and y before asking us why they're not equal?
>Fair's fair.

Aside from verifying what classes x and y are, we should look for spurious
spaces, etc.

Does count of x = count of y? (We don't care about relative speed of ways
to get length, here.)

Or...try display dialog "[" & x & "]" and the same for y. Any clues?

--John
--
John Baxter email@hidden Port Ludlow, WA, USA


References: 
 >Re: comparing two identical strings (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: bug in rest of list?
  • Next by Date: Re: bug in rest of list?
  • Previous by thread: Re: comparing two identical strings
  • Next by thread: comparing two identical strings
  • Index(es):
    • Date
    • Thread