更新时间:2022-11-07 23:34:14
这是一种非LINQ的方法:
Here's a non-LINQ method of doing it:
string str = "Today is friday! I'm am having trouble programming this. Today is friday! Tomorrow is saturday. Today is friday!";
StringBuilder sb = new StringBuilder();
int index = 0;
do
{
index = str.IndexOf("Today is friday!", index);
if (index != -1)
{
sb.Append("Today is friday!");
index++;
}
} while (index != -1);
string repeats = sb.ToString();