int GetAppearTimes(string str1,string str2){
int i=0;
while(str1.IndexOf(str2)>=0){
str1=str1.Substring(str1.IndexOf(str2)+str2.Length);
i++;
}
return i;
}
int GetAppearTimes(string str1,string str2){
Regex ex=new Regex(str2);
return ex.Matches(str1).Count;
}
Regex.Matches(str1,str2).Count;
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yxtyxt3311/archive/2007/03/05/1521308.aspx
转载于:https://www.cnblogs.com/xiaofengfeng/archive/2010/12/09/1901470.html