c#中怎样能把文本中的float数据读到一个数组中,
170,1700,292,5,1.030376570,1300,292,5,0.54041951020,1050,224,5,0.46364761...
170, 1700,292,5,1.030376
570, 1300,292,5,0.5404195
1020,1050,224,5,0.46364761 展开
570, 1300,292,5,0.5404195
1020,1050,224,5,0.46364761 展开
1个回答
展开全部
string arr =@"170, 1700,292,5,1.030376
570, 1300,292,5,0.5404195
1020,1050,224,5,0.46364761";
var temp= arr.Split(new char[] {' ', ',',',' ,'\r','\n'}, tringSplitOptions.RemoveEmptyEntries);
float[] arrlist = new float[temp.Length];
for (int i = 0; i < temp.Length; i++)
{
arrlist[i] = float.Parse(temp[i]);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询