C#代码循环问题 求教 试了一晚上了。。。
for (line = 22; line < linesArray.Count()-2; line = line + 17)
{
string str = linesArray[line].ToString();
t[a] = double.Parse(str.Substring(14, 2)) * 60 + double.Parse(str.Substring(17, 2));
string str1 = linesArray[line + 1 + b].ToString();
x[a] = double.Parse(str1.Substring(5, 13));
string str2 = linesArray[line + 1 + b].ToString();
y[a] = double.Parse(str2.Substring(19, 13));
string str3 = linesArray[line + 1 + b].ToString();
z[a] = double.Parse(str3.Substring(33, 13));
a = a + 1;
}
for (line=22; line <= linesArray.Count()-2; line=line+17)
{
t0 = t0 + 15;
string XH = linesArray[line + 1].ToString().Substring(1, 3);
string SJH = linesArray[line].ToString().Substring(14, 2);
string SJF = linesArray[line].ToString().Substring(17, 2);
int j = 0;
这是两端连在一起的代码,运行之后显示 倒数第四行 Substring(1,3) 里面大于字符串长度 linesArray[]里面的长度应该是够的,问题会不会出现在line?????
------解决方案--------------------vs2010提示大于字符串长度就是大于字符串长度.要信.