How to get substring from given string in C#

C# provides the method of finding substring from a given string by using overloaded substring() method. We can use substring methods in two ways like this:

Str.Substring(N) –> this extracts a substring starting from Nth position to the last character of string contained in str.

Str.Substring(N1,N2)–>this extracts a substring from string str, beginning at N1th position and ending at N2th  position


            string str = “Finding Substring”;

            String substring1=str.Substring(8);

            string substring2 = str.Substring(4, 9);


the value of substring1=”Substring”

the value of Substring2=”ing Subst”