• 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: Escape character problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Escape character problem


  • Subject: Re: Escape character problem
  • From: Andrew Oliver <email@hidden>
  • Date: Thu, 17 Mar 2005 01:48:28 -0800

On 3/17/05 1:34 AM, "Brian Gist" <email@hidden> wrote:

> I know this sounds silly, but this is literally driving me crazy.
>
> I'm trying to get a line in quoted text.  I want it to say
> "Name"
> literally.
>
> When I do ...
>
> set nameVar to "  \"Name\" "
> get nameVar
>
> the result, frustratingly enough is exactly
>
> "  \"Name\" "
>
> Shouldn't the \" be an escape character telling it to display the
> quotes, but not the backslash?

That's exactly what you have.

Don't get confused with AppleScript's _display_ of the string and the string
itself.

If you ask AppleScript to display the string (e.g. via log) it will insert
the backslashes to denote the quote character within the string as opposed
to the normal quote delimiter.

You can verify this by asking for the length of the string:

set nameVar to "\"Name\""
length of nameVar
--> 6 - the characters "N", a", "m", "e" and the two quotes.

Andrew
:)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Escape character problem (From: Brian Gist <email@hidden>)

  • Prev by Date: Re: getting chunks of text
  • Next by Date: Re: getting chunks of text
  • Previous by thread: Escape character problem
  • Next by thread: Re: Escape character problem
  • Index(es):
    • Date
    • Thread