Exemplo n.º 1
0
        //Method that combines the cleaner with the counter from the backend
        public static void resultPrinter(string sentence, string word)
        {
            string cleaned = RepeatCounter.sentenceCleaner(sentence);
            int    occur   = RepeatCounter.countRepeats(cleaned, word);

            if (occur > 0)
            {
                Console.Write("Your word ");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write($"'{word}' ");
                Console.ResetColor();
                Console.Write("repeats in the sentence you supplied ");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write($"{occur} ");
                Console.ResetColor();
                Console.Write("time(s).");
            }
            else
            {
                Console.WriteLine($"Looks like {word} does not exist in your sentence or there was a typo.");
            }
        }