作者liptonbin (wind)
看板C_Sharp
标题[问题] 请问split问题
时间Tue Sep 4 17:00:59 2007
请问我在c#上面要分割 如41 99 311 16
50 99 300 100
52 10 11 20
...
这四个数字
string[] words1 = Regex.Split(str,@"\s+");
textBox1.Text = words1[0];
textBox2.Text = words1[1];
textBox3.Text = words1[2];
textBox4.Text = words1[3];
经过以上可能变成
textBox1.Text = words1[0]=>41
textBox2.Text = words1[1]=>99
textBox3.Text = words1[2]=>311
textBox4.Text = words1[3];
但是有时候换另外一行又可以
请问为什麽有时候会缺一个
我的regex.split有少写什麽吗?(空格可能有tab键或空格+tab键等)
谢谢喔
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.69.149.252
1F:→ bcse:少了 \r 或 \n 吗? 09/04 20:01
2F:→ liptonbin:我用@"[\s\r\t]+" 还是不行 09/04 21:47