gurkensaas
gurkensaas

Reputation: 913

How to get a string in applescript that contains a quote

I want to have a string that contains a quote. So the code would look something like this: return "hello"world" and it should return hello"world. In other programming languages you could either escape the quote or use the other quote, but neither seems to work in Applescript.

Upvotes: 1

Views: 86

Answers (1)

user3439894
user3439894

Reputation: 7555

Test these two lines of code:

set foo to "Hello\"World"
display alert foo

You'll see the real value of foo, Hello"World, as apposed to return foo which shows: "Hello\"World"

You'll see the double-quote escaped in a return statement because what would normally receive foo, in this case, will strip the \ from it.

enter image description here

Upvotes: 1

Related Questions