例如txt文档中是下面内容
***********************txt*****************************
1 3.5 2.8
2 4.0 3.7
3 5.0 5.0
***********************txt******************************
如上面,第一列是ID号,第二列是X坐标,第三列是Y坐标,怎么样才能把x,y坐标分别存到已有数组pointX[]和point[Y]中去,请大家帮忙,最好写出主要方法,还有全部代码
***********************txt*****************************
1 3.5 2.8
2 4.0 3.7
3 5.0 5.0
***********************txt******************************
如上面,第一列是ID号,第二列是X坐标,第三列是Y坐标,怎么样才能把x,y坐标分别存到已有数组pointX[]和point[Y]中去,请大家帮忙,最好写出主要方法,还有全部代码
string sLine = "";
List<string> pointX = new List<string>();
List<string> pointY = new List<string>();
while (sLine != null)
{
sLine = objReader.ReadLine();
if (sLine != null && !sLine.Equals(""))
{
string[] t = sLine.Split(' ');
pointX.Add(t[1]);
pointY.Add(t[2]);
}
}
objReader.Close(); string[] x=pointX.ToArray();
string[] y = pointY.ToArray();