Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference Between Single and Double Quoted Strings in ActionScript

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

like image 338
regjo Avatar asked Jan 15 '10 17:01

regjo


3 Answers

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.'
like image 172
Guffa Avatar answered Sep 17 '22 15:09

Guffa


No.

// * required - at least 15 characters

like image 36
kennytm Avatar answered Sep 18 '22 15:09

kennytm


There is no difference.

This is from ActionScript: The definitive Guide:

String is the datatype used for textual data (letters, punctuation marks, and other characters). A string literal is any combination of characters enclosed in quotation marks:

    "asdfksldfsdfeoif"  // A frustrated string
    "greetings"         // A friendly string
    "[email protected]"   // A self-promotional string
    "123"               // It may look like a number, but it's a string
    'singles'           // Single quotes are acceptable too
like image 38
Diego Dias Avatar answered Sep 20 '22 15:09

Diego Dias