Skip to content

Instantly share code, notes, and snippets.

@scorta
Created July 31, 2014 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scorta/260dcf4988ca76821976 to your computer and use it in GitHub Desktop.
Save scorta/260dcf4988ca76821976 to your computer and use it in GitHub Desktop.
private int CountChar(string src, char x)
{
int count = 0;
for (int i = 0; i < src.Length; i++)
{
//.ToString().ToUpper(): CaSe sensitive or not
if (x.ToString().ToUpper() == src[i].ToString().ToUpper()) count++;
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment