Check out example codes for "c sharp substring". It will help you in understanding the concepts better.

Code Example 1

// 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!"

Code Example 2

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)); 
    } 
}

Code Example 3

//Get a string between a start index and end index    
string str = "How to find a substring in a string";    
int startIndex = 7;    
int endIndex = str.Length - 7;    
string title = str.Substring(startIndex, endIndex);

Learn ReactJs, React Native from akashmittal.com