How to put quotes within a quoted string?

Posted by David Berthiaume on Tue 07 Feb 2006 06:50 AM — 4 posts, 25,837 views.

#0
How do I put "" into a Note?

Note "Bob said to sharon "You know, we should go see a movie tonight....""
USA #1
I think that VB script uses "" to mean ". So if you wanted to post the below, you'd have to write:

Note "Bob said to sharon "You know ... """. That way, of the three quotation marks, two will be interpreted to mean "insert a quotation mark into the string here".
Australia Forum Administrator #2
In some languages you can escape the quote with backslash. Lua and Jscript spring to mind.

eg.

Note "Bob said to sharon \"You know, we should go see a movie tonight....\""

This is really a language-specific issue. Read the documentation for the language you are using to see how to put quotes within quotes.

In Lua, you can use the other quote, like this:

Note 'Bob said to sharon "You know, we should go see a movie tonight...."'

This assumes, of course, you don't want single quotes inside the string too. If you did, you would then need to resort to the backslash trick.
USA #3
In any language you can also concatenate Chr(34) into the string:

VBScript: Note "WillFa thought " & chr(34) & "This is a tedious way to do it." & chr(34)

In Python you can use triple quotes to give formatted text:

world.Note("""WillFa thought "This way
I can even insert new lines without escaping them."""")