.NET Fiddle

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		var text = "Today is a good day for help. **David Diaz He went to school. **David Diaz like apple. ";
		var pos = 0;
		var num = 0;
		var search = "**David Diaz";
		 while ((pos = text.IndexOf(search, pos)) > -1)
        {
            num ++;
            pos += search.Length;
        }
		
		Console.WriteLine(num);
	}
}
;