CSharp string Split function returns an array of String containing the substrings delimited by the given System.Char array.
string[] string.split(string[] separator)
Parameters:
separator - the given delimiter
Returns:
An array of Strings delimited by one or more characters in separator
using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string str = null;
string[] strArr = null;
int count = 0;
str = "CSharp split test";
char[] splitchar = { ' ' };
strArr = str.Split(splitchar);
for (count = 0; count < = strArr.Length - 1; count++)
{
MessageBox.Show(strArr[count]);
}
}
}
}