C#查找子串在原串中出现次数

  提供的是一种思路,和具体语言无关。

string test = "good good study day day up";
string r = test.Replace("oo","");
int num = (test.Length - r.Length) /"oo".length; 
Console.WriteLine(num);

  

posted @ 2015-06-12 08:29  加拿大小哥哥  阅读(470)  评论(0编辑  收藏  举报