1 Reply Latest reply on Aug 3, 2008 4:09 AM by Dr. Fred Mbogo

    Special Symbols

    sri harsha namala Level 2
      Hi Every One,
      I have a String in my application as var str:String="Abc";
      What i want is that i want to Store that String as "Abc" means it have to take double quotes also in my String str
      So now i should have String parameters as "Abc" including double quotes how to do that?

      Thanks in advance.

        • 1. Re: Special Symbols
          Dr. Fred Mbogo Level 1
          You have two options for including quotation marks in a string in ECMAScript. (Parent language to both ActionScript and JavaScript.)

          First, unlike some other languages, ECMAScript allows use of either single or double quotes, with no difference in functionality. So, in a simple example like yours, where you need to use only one type in your string, you use the other in your program: var str:String = '"ABC"'; Due to the font they've chosen for this forum page and lack of a code quoting feature, a different example will be clearer: var str:String = 'Click the "Start" button to begin the process.';

          Second, you can escape quotation marks with a backslash to cause them to be taken as part of the string, not terminating it: var str:String = "\"ABC\""; Although the above examples may be harder to read here in the forum, programmer's text editors almost always use fixed-width fonts, so double and single quotes are easy to tell apart, even right next to each other as in the ABC example. So, the general rule is to minimize the number of backslashes you need by proper choice of the outer quote type.