我不明白这里出了什么问题。有人可以解释一下吗?
using System;
public class Test
{
public static void Main()
{
int bobo = 0;
string result = "";
string bob;
string search = Console.ReadLine();
string words = Console.ReadLine();
string first = words.Substring(0,1);
string second = words.Substring(1,2);
string third = words.Substring(2,3);
for(int i = 0;i<searchc.Length;i++)
{
bobo++;
bob = search.Substring(bobo,bobo+2);
if(bob == first)
{
result += bob.ToUpper();
}
}
Console.WriteLine(result);
}
}
我看到的错误信息是:
Unhandled Exception: System.ArgumentOutOfRangeException: startIndex + length > this.length
Parameter name: length
at System.String.Substring (Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
at Test.Main () [0x00000] in <filename unknown>:0