2010年1月19日 星期二

[c#] String字串處理Split 應用介紹-[Split]

String字串處理Split 應用介紹-[Split]

//split
private void button_Click(object sender, EventArgs e)
{

char[] del = new char[] { ',','/' }; //多符號分離
//char del = ','; //單符號分離

string line = "datalog_mo1_0,2010/1/19下午 01:47:52,691,1,40197574905.7755";

string[] split = line.Split(del);

foreach (string s in split)
{
listBox1.Items.Add(s); //送到目標 listbox檢視
}

}

沒有留言:

張貼留言