split the string using some operator in C#.?

Naveenhcl
Posted by Naveenhcl under ASP.NET category on | Points: 40 | Views : 792
In this section I will explain how to split the string using some operator.

In most of the places we need to split the string with specified operator for that we just go with Split method with passing the specified operator based on this operator we can split the string into number of parts.

EX:

string result="I LOVE MY INDIA";

result= result.Split(" ")[0]; // output : I
result= result.Split(" ")[1]; // output : LOVE
result= result.Split(" ")[2]; // output : MY
result= result.Split(" ")[3]; // output : INDIA

Comments or Responses

Login to post response