35
0 47.12 47.47 43.45
1 48.31 46.67 45.62
2 48.47 40.07 40.11
3 41.89 49.43 42.52
4 42.76 44.42 48.52
5 48.93 43.49 40.7
6 40.38 49.59 45.34
7 47.71 41.6 42.04
8 40.35 46.28 45.02
9 48.94 47.3 45.03
10 43.54 43.64 46.94
11 47.43 46.4 46.01
12 45.28 43.11 40.94
13 42.56 43.67 43.62
14 45.35 43.53 40.64
15 44.5 42.29 46.12
16 42.75 43.79 42.77
17 44.59 46.76 43.51
18 43.49 49.4 45.87
19 41.42 47.96 40.39
20 40.61 49.52 42.78
21 45.08 48.35 45.79
22 45.58 45.32 48.03
23 42.51 43.65 40.38
24 49.76 47.82 45.92
25 41.71 42.36 48.07
26 41.4 45.85 43.99
27 48.9 46.2 43.51
28 42.26 48.95 46.88
29 43.43 43.94 46.99
30 40.14 43.86 45.14
31 40.55 41.96 44.15
32 40.85 40.28 45.18
33 44.85 48.92 46.97
34 48.09 40.24 40.14
35 42.39 44.83 48.94 这是数据,我想读第二列和第三列数据, 请问该如何操作,最好附上代码 谢谢!
0 47.12 47.47 43.45
1 48.31 46.67 45.62
2 48.47 40.07 40.11
3 41.89 49.43 42.52
4 42.76 44.42 48.52
5 48.93 43.49 40.7
6 40.38 49.59 45.34
7 47.71 41.6 42.04
8 40.35 46.28 45.02
9 48.94 47.3 45.03
10 43.54 43.64 46.94
11 47.43 46.4 46.01
12 45.28 43.11 40.94
13 42.56 43.67 43.62
14 45.35 43.53 40.64
15 44.5 42.29 46.12
16 42.75 43.79 42.77
17 44.59 46.76 43.51
18 43.49 49.4 45.87
19 41.42 47.96 40.39
20 40.61 49.52 42.78
21 45.08 48.35 45.79
22 45.58 45.32 48.03
23 42.51 43.65 40.38
24 49.76 47.82 45.92
25 41.71 42.36 48.07
26 41.4 45.85 43.99
27 48.9 46.2 43.51
28 42.26 48.95 46.88
29 43.43 43.94 46.99
30 40.14 43.86 45.14
31 40.55 41.96 44.15
32 40.85 40.28 45.18
33 44.85 48.92 46.97
34 48.09 40.24 40.14
35 42.39 44.83 48.94 这是数据,我想读第二列和第三列数据, 请问该如何操作,最好附上代码 谢谢!
StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default); while (!sr.EndOfStream)
{
stringtxt = sr.ReadLine(); //这里读出每一行,再根据空格的位置读出空格间的数据
}
string stringtxt;
FileStream fs = new FileStream(fName, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default); while (!sr.EndOfStream)
{
stringtxt = sr.ReadLine(); //这里读出每一行,再根据空格的位置读出空格间的数据
if (stringtxt.Length>2)//排除第一行 35
{
string[] st=stringtxt.Split(' ');
string st1=st[1].ToString();//读出第2列
string st2=st[2].ToString();//读出第3列
listBox1.Items.Add(st1);
listBox2.Items.Add(st2);
}
}
foreach(string s in arr)
{
string[] arr2=s.Split(new String[]{" "},StringSplitOptions.RemoveEmptyEntries);}
string st2=st[2].ToString();//读出第3行
string[] st=stringtxt.Split(' ');这是对这行按空格进行分解各个数
string st1=st[1].ToString();//读出第2个数
string st2=st[2].ToString();//读出第3个数