Search code examples
actionscript-3string

Difference Between Single and Double Quoted Strings in ActionScript


Is there any difference between single and double quoted strings in ActionScript?


Solution

  • You can use either as delimiter for a string. They are however not interchangeable, i.e. you can't start a string with an apostrophe and end it with a quotation mark.

    The only difference is which characters you need to escape. Inside a string delimited by quotation marks you need to escape quotation marks but not apostrophes, and vice versa.

    To put the text He said "It's all right" and laughed. in a string you can use:

    "He said \"It's all right\" and laughed."
    

    or:

    'He said "It\'s all right" and laughed.'