int count = Regex.Matches(test, "word").Count;
# cCopyusing System;
using System.Linq;
namespace get_first_char_of_string
{
class Program
{
static void Main(string[] args)
{
string source = "/once/upon/a/time/";
int count = source.Split('o').Length - 1;
Console.WriteLine(count);
}
}
}
string source = "/once/upon/a/time/";
int count = 0;
foreach (char c in source)
if (c == '/') count++;