• 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: Paul Berkowitz <email@hidden>
  • Date: Sat, 02 Feb 2002 20:48:20 -0800

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.

--
Paul Berkowitz


  • Follow-Ups:
    • Re: comparing two identical strings
      • From: John W Baxter <email@hidden>
References: 
 >comparing two identical strings (From: email@hidden)

  • Prev by Date: Re: There's a length limit to AppleScripts (AS Editor 1.7)?
  • Next by Date: Re: Scripting Additions: Embracing the Horror of Unix
  • Previous by thread: comparing two identical strings
  • Next by thread: Re: comparing two identical strings
  • Index(es):
    • Date
    • Thread