怎样用C#读取以下txt文件的数据,能把数据分开存储在不同数组中
11.00000400000000e-07-2.00001600000000e-1221.00001600000000e-07-4.00012800000000e-123...
1 1.00000400000000e-07 -2.00001600000000e-12
2 1.00001600000000e-07 -4.00012800000000e-12
3 1.00003600000000e-07 -6.00043200000000e-12
4 1.00006400000000e-07 -8.00102400000000e-12
5 1.00010000000000e-07 -1.00020000000000e-11
6 1.00014400000000e-07 -1.20034570000000e-11
7 1.00019600000000e-07 -1.40054890000000e-11
8 1.00025600000000e-07 -1.60081950000000e-11
9 1.00032410000000e-07 -1.80116690000000e-11
10 1.00040010000000e-07 -2.00160090000000e-11
文件格式如上,数据之间隔的是/t,请问如何读取 展开
2 1.00001600000000e-07 -4.00012800000000e-12
3 1.00003600000000e-07 -6.00043200000000e-12
4 1.00006400000000e-07 -8.00102400000000e-12
5 1.00010000000000e-07 -1.00020000000000e-11
6 1.00014400000000e-07 -1.20034570000000e-11
7 1.00019600000000e-07 -1.40054890000000e-11
8 1.00025600000000e-07 -1.60081950000000e-11
9 1.00032410000000e-07 -1.80116690000000e-11
10 1.00040010000000e-07 -2.00160090000000e-11
文件格式如上,数据之间隔的是/t,请问如何读取 展开
1个回答
展开全部
List<string> column0 = new List<string>();
List<string> column1 = new List<string>();
List<string> column2= new List<string>();
using(StreamReader r = new StreamReader("test.txt"))
{
string line = r.ReaderLine();
string[] columns = null;
while(line!=""&&line!=null)
{
columns = line.Split('\t');
column0.Add(columns[0]);
column1.Add(columns[1]);
column2.Add(columns[2]);
line = r.ReadLine();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询