我在 String fromIndexString = topStiva.Substring(topStivaLength + 1, topStiva.Length); . 我表明 topStiva.Length 超出或范围。
代码如下:
字符串actiuneRezultata(字符串topStiva,字符串cuvIntr){
int index = -1;
String primulCharCuvIntr = cuvIntr.Substring(0, 1);
if (primulCharCuvIntr.Equals("+") == true)
primulCharCuvIntr = "\\" + primulCharCuvIntr;
else
if (primulCharCuvIntr.Equals("*") == true)
primulCharCuvIntr = "\\" + primulCharCuvIntr;
else
if (primulCharCuvIntr.Equals("*") == true)
primulCharCuvIntr = "\\" + primulCharCuvIntr;
else
if (primulCharCuvIntr.Equals("*") == true)
primulCharCuvIntr = "\\" + primulCharCuvIntr;
else
if (primulCharCuvIntr.Equals("*") == true)
primulCharCuvIntr = "\\" + primulCharCuvIntr;
for (int i = 0; i < ta.Length; i++) {
if (ta[i].CompareTo(primulCharCuvIntr) == 0) {
index = i;
break;
}
}
int topStivaLength = topStiva.Length - 1;
while (topStiva[topStivaLength] >= '0' && topStiva[topStivaLength] <= 9)
topStivaLength--;
String fromIndexString = topStiva.Substring(topStivaLength + 1, topStiva.Length);
int fromIndex = int.Parse(fromIndexString);
if (index < 0)
return "Nu face parte din gramatica!";
else
return tabela[fromIndex][index];
}
topStiva 的值是从调用 actiuneRezultata(stivaAPD.Peek().ToString(), another_value) 中获取的
我在 stivaAPD 中看到我在推送一些值后感到很高兴。那么为什么超出范围呢?请帮忙!