例如有如下字符串
string a=123dsfsadfsa123adsfads
string b=123
我如何知道b在a中出现的次数
string a="123dsfsadfsa123adsfads";
string b="123";
string tempstr = a;
tempstr=tempstr.Replace(b, "");
int charcount=(a.Length-tempstr.Length);
int count=0;
if (charcount > 0)
count = charcount / b.Length;