Splitting and Joining a string

Posted by Akiii under C# category on | Points: 40 | Views : 1461
Here I am using a console application. First we will split the string and then we will join it. Splitting a string need some argument or something to split and the same is with joining also.

string myString = "Dotnet Funda";
string[] myArray = myString.Split(' ');

for (int i = 0; i < myArray.Length; i++)

string jString = string.Join("----", myArray);


In the above, we have taken a string variable with value as "Dotnet Funda". We have splitted the string using 'space', stored in an array and used a for loop to view the output.
Similarly, we have joined a string using '----'.

I hope the above is useful !

Thanks and Regards

Comments or Responses

Login to post response