Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    A demonstration of strings in C#.Lecture 2 - slide 10 : 43
Program 3
using System;

class ArrayStringDemo{

  public static void Main(){
     string s1        = "OOP";
     System.String s2 = "\u004f\u004f\u0050";   // equivalent
     Console.WriteLine("s1 and s2: {0} {1}", s1, s2);

     string s3 = @"OOP on                             
            the \n semester ""Dat1/Inf1/SW3""";       
     Console.WriteLine("\n{0}", s3);

     string s4 = "OOP on \n            the \\n semester \"Dat1/Inf1/SW3\"";   
     Console.WriteLine("\n{0}", s4);

     string s5 = "OOP E06".Substring(0,3);
     Console.WriteLine("The substring is: {0}", s5);
  }   

}
 
 
 
 
 
 
 
 
 
a so-called verbatim string constant. 
\n is not interpreted as newline
 
 
\n is interpreted as newline