Hi,
I want to get a count of each english letter in a text file.The lower case and upper case letter should be taken as 1 letter(i.e A and a should be counted as 1 letter).This is my code but it takes capital A ans simple a as 2 letters. Can anyone help?
int[] c = new int[(int)char.MaxValue];
string file = openFileDialog.FileName;
string s = File.ReadAllText(file);
foreach (char t in s)
{
c[(int)t]++;
}
for (int i = 0; i < (int)char.MaxValue; i++)
{
if (c[i] > 0 &&
char.IsLetter((char)i))
{
Console.WriteLine("Letter: {0} Frequency: {1}",
(char)i,
c[i]);
}