find occurrence of a character in a string
Sigiloso
public static int GetCharCount(string s, char c) { int count = 0; for (int i = 0; i < s.Length; i++) { if (s[i] == c) count++; } return count; } static void Main(string[] args) { string str = "test string to check e occurrence"; char c = 'e'; Console.WriteLine(GetCharCount(str, c)); Console.ReadLine(); }