The Substring() Method is used to return a new string starting from the start index.
public class MyApplication { public static void Main(string[] args) { string x = "Hello Girl"; string y = x.Substring(6); System.Console.WriteLine(y); } }
In the above code, we have declared a String Hello Girl.
string x = "Hello Girl";
Now, we will extract the substring Girl from the String Hello Girl.
So, we have used the Substring() to extract the substring Girl.
string y = x.Substring(6);
So, the substring Girl starts from index/position 6.
string y = x.Substring(6);
And we got the output as Girl.