Using Quotes and Apostrophes in Strings : Escape « String « Flash / Flex / ActionScript






Using Quotes and Apostrophes in Strings

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var exampleA:String = 'He said, "Yes."';
        
        var exampleB:String = "He said, 'Yes.'";
        
        var exampleC:String = "He said, \"Yes.\"";
        
        trace(exampleA);
        trace(exampleB);
        trace(exampleC);

    }
  }
}

        








Related examples in the same category

1.A complete listing of all the escape sequences available to you
2.Passing String Values to and from Applications (escape)
3.unescape() function does not modify the existing string, but returns a new string
4.Escaping Characters
5.The backslash character has a special function when used in a string literal
6.An example of the newline character used in a string
7.Display \n literally, instead of a newline, you can add an additional backslash just before it
8.Inserting Special Whitespace Characters: Newline \n
9.Inserting Special Whitespace Characters: Tab \t
10.Inserting Special Whitespace Characters: Backspace \b
11.Inserting Special Whitespace Characters: Form feed \f
12.Inserting Special Whitespace Characters: Carriage return \r