Its weird,well i need to count characters from file, and in later computations use that information, now its weird part, i wanted to check if my program is correctly countig appearance of each character so i compared my results with monodevelop matches from ctrl+f
for example for ‘i’ character my result is 518 monodevelop has 561 matches (with case sensitivity on), so maybe it coudl look like my programm does not count well but i made test and rewrited it to another file and again checked matches in mono develop now my results and monodevelop matches where same. Why is it happening ?
here is code
public Histogram (String nazwa)
{
histogram = new Dictionary<string,float>();
StringBuilder plik = odczytPliku.odczyt(nazwa);
n = 0;
foreach(char w in plik.ToString())
{
if(!histogram.ContainsKey(new string(w,1)))
histogram.Add(new string(w,1),1);
else
histogram[new string(w,1)]+=1;
n++;
}
}
The following code will create a histogram of characters in a string. This assumes you’re passing in the string correctly.