1

How can I declare a string with quotes in Actionscipt 3 like this:

var str1:String="(SayText "Hello world.")";

Some symbols like < can be taken care as &lt.quotes

3 Answers 3

10

Did you mean quotes instead of parenthesis? Your example string doesn't work because of the double quotes whithin your String.

You either have to escape the quotes within the String or you need to put the String within single quotes.

var str1:String = "(SayText \"Hello world.\")";
var str2:String = '(SayText "Hello world.")';
Sign up to request clarification or add additional context in comments.

1 Comment

quotes is causing problem here
1

If I don't misunderstand you the answer is simple:

var s : String = '(SayText "Hello World")';
trace(s);

Comments

0
var str1:String="(SayText "Hello world.")";

Quote '"' is causing problem here. Not parentheses. Try this,

var str1:String="(SayText \"Hello world.\")";

Or this

var str1:String='(SayText "Hello world.")';

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.