调试下面程序出现了死循环 什么原因
int cishu = 0;
string str = "Welcome to Chinaworld",str1="";
str=str.ToLower();
string[] words = str.Split(' ');
for (int i = 0; i < words.Length; i++)
{
str1 += words[i];
}
for (int i = 0; i < str1.Length; i++)
{
int j = 0;
while(str1.IndexOf(str1[i],j)!= -1)
{
cishu++;
j = str1.IndexOf(str1[i])+1;
}
Console.WriteLine("{0} {1}",str1[i],cishu);
cishu = 0;
|