String SubString() Method in C#

String SubString() Method in C#

SubString() – The C# SubString() method is used to return a part of string from given string.
In this method we provide two integer parameter for substring. The first one is the starting point and second one is the specify the length of substring.

C# Example of SubString()
SubString() Example in C#

In above SubString() example we inputted string “Meera Academy” in textbox. We specified SubString(1,8) means Start index is 1 and total string length is 8 characters. The result substring is  “eera Aca” from string “Meera Academy”.

C# code for SubString() button click:

protected void Button1_Click(object sender, EventArgs e)
Label1.Text = TextBox1.Text.SubString(1,8);

Related ASP.Net Topics :

Subscribe us

If you liked this post, then please subscribe to our YouTube Channel for more video tutorials.

We hope that this tutorial helped you to understand String SubString() method.

Next tutorial we will learn about C# String ToUpper() and ToLower().

Leave a Reply

Your email address will not be published. Required fields are marked *