Hi all,
We have seen splitting a string, now we will see how to join a string. Follow the code below:-
First, take some strings in a string variable,
string str = "item1, item2, item3";
Split the string with the help of the Split method,
string[] arr = str.Split(new Char[] {','}); Take another string variable for joining purpose,
string jnstr;
The above array which contains the split strings are passed as an argument to the join function
jnstr = String.Join("-", arr); Print the value of the variable "jnstr",
Response.Write(jnstr);
That's it, execute the code above.....
Thanks and Regards
Akiii