c sharp substring

C#
// To get a substring of a string use 'Substring()'
// The first value is the index of where to start and the second
// value is the lenght of the substring.
string str = "Hello World!"
str.Substring(3, 4) // Output: "lo W"
  
// If you only give a starting index, it will go until the end
str.Substring(3) // Output: "lo World!"using System; 
class HellWorld { 
  
    // Main Method 
    public static void Main() 
    { 
  
        // define string 
        String str = "Let us code"; 
  
        Console.WriteLine("String    : " + str); 
  
        // retrieve the substring from index 5 
        Console.WriteLine("Sub String1: " + str.Substring(5)); 
  
        // retrieve the substring from index 8 
        Console.WriteLine("Sub String2: " + str.Substring(8)); 
    } 
}
Source

Also in C#: