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);

  

原文地址:https://www.cnblogs.com/hxsyl/p/4570771.html