Re: Escape character problem
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