当然出错了!
strsq在foreach里面变成了局部变量,外部的string strsq="ddd"在foreach里面已经无效!string strsq="ddd";
int count=0;
foreach(string strs in arraryb)
{
if(strs.IndexOf(strsq)>0)
{
count++;
}
}
strsq在foreach里面变成了局部变量,外部的string strsq="ddd"在foreach里面已经无效!string strsq="ddd";
int count=0;
foreach(string strs in arraryb)
{
if(strs.IndexOf(strsq)>0)
{
count++;
}
}
int count=0;
if (arraryb.IndexOfAny(strsq)>=0)
{
count+=1;
}
应该是:
string strsq="ddd";
int count=0;
if (strsq.IndexOfAny(arraryb)>=0)
{
count+=1;
}
indexof ,indeofany都是针对char[]数组吗?
两个有什么区别?///////////
我的qq 99806311
email:[email protected]