const string Str1 = "0.25,0.26,0.36,0.84,0.29";
const string Str2 = "0.15,0.56,0.36,0.34,0.29,";
var sub1 = Str1.Split(',');
var sub2 = Str2.Split(',');
var d1 = new double[sub1.Length];
var d2 = new double[sub2.Length];
for (int i = 0; i < sub1.Length; i++)
{
d1[i] = Convert.ToDouble(sub1[i]);
}
for (int i = 0; i < sub2.Length; i++)
{
d2[i] = Convert.ToDouble(sub2[i]);
}
需要注意的是,你的分隔符为全角的",",但是我又同样注意到你的引号也是全角的,所以我不太能够确定你是写错了还是故意要这样的,你自己根据实际情况来确定吧。也就是说,你的string里面的分隔符是什么,Split()方法中就传什么就可以了。