String Split() Method in C#



String Split() Method in C#

Split() – The C# Split method used to splits a string an array of given string based on the specified value.

C# Example of Split()

meeraacademy.com
String Split() Example in C#

C# code for Split() button click:

protected void Button1_Click(object sender, EventArgs e)
{
string[] str = TextBox1.Text.Split('-');
Label1.Text = str[0] + " <br />" + str[1] + "<br />" + str[2];
}
meeraacademy.com
String Split() Example in C#

In above c# split() example, we split the inputted textbox string by “-” parameter. Here we input string “my-nameis-meera”. The Split delimiter is “-” , so given string returns an array string of  three part from original.

Related ASP.Net Topics :

Subscribe us

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

We hope that this C#.net tutorial helped you to understand String Split() method.


Next asp.net tutorial we will learn about C# String SubString() Function.


Leave a Reply

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