示例#1
0
        private void CountWords()
        {
            int ctrIndex    = 65; // starting numeric index of a alphabet, 65=a, 66=b etc
            int ctrIndexMax = 90; // last numeric index of a alphabet, 90=z
            int multiplier  = 1;

            foreach (var word in WordList)
            {
                var wc = new WordCounter();
                wc.FindWordInList(word, ParagraphList);

                string joined = StringManipulation.Join(",", wc.wordInParagraph);

                string alphabet = StringManipulation.IntToAlphabet(ctrIndex);

                string strIndex = new StringBuilder().Insert(0, alphabet, multiplier).ToString();

                Console.WriteLine($"{strIndex}. {word} {{{wc.frequency.ToString()}:{joined}}})");

                if (ctrIndex == ctrIndexMax)
                {
                    ctrIndex = 65;
                    multiplier++;
                }
                else
                {
                    ctrIndex++;
                }
            }
            Console.ReadLine();
        }