Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void buttonAnalysis_Click(object sender, EventArgs e)
- {
- string text = textBox.Text;
- Dictionary<char, int> result = new Dictionary<char, int>();
- foreach (var ch in chars)
- {
- int count = 0;
- for (int i = 0; i < textBox.Text.Length; i++)
- {
- if (text[i] == ch || text[i] == Char.ToUpper(ch))
- count++;
- }
- result.Add(ch, count);
- }
- var sortedDict = from entry in result orderby entry.Key ascending select entry;
- textBoxOut.Clear();
- foreach (KeyValuePair<char, int> item in sortedDict)
- {
- if(item.Value != 0)
- textBoxOut.AppendText(Char.ToUpper(item.Key) + ": " + item.Value + "\r\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement