Quantity of specific strings inside a string

.net, c#, string

Solution

You can use regular expressions for this and right about anything you want:

string s = "Whatever text FFF you can FFF imagine";

Console.WriteLine(Regex.Matches(s, Regex.Escape("FFF")).Count);

Problem

I'm working in .net c# and I have a string text = "Whatever text FFF you can FFF imagine"; What i need is to get the quantity of times the "FFF" appears in the string text. How can i acomplished that? Thank you.

Original source