请问在c#中如何实现以下转换功能???

来源:百度知道 编辑:UC知道 时间:2024/06/23 17:28:40
如果一个TextBox里输入"12 23 43 56 1 23"
得到一个数组ArrayList={12,23,43,56,1,23}???????????
请不吝赐教!
还有一个小要求,就是"1 2 3 4"能分成{1,2,3,4},"1 2 3 4"中间隔着很多空格也能分成{1,2,3,4}

arraylist=TextBox.text.split{new char{''}};
用字符串的split函数,你查一下 我写可能不对。

string temp = "12 23 43 56 1 23";
Array arraylist = temp.Split(' ');

split函数和replace函数

string ss = "12 23 43 56 1 23";
string ass = ss.Replace(" ", ",");