コード例 #1
0
        public static void DisplayMostUsedCharacters(string sentence)
        {
            var chars = sentence.StripAll();

            var mostUsed = GetMostUsedChar(chars).Key;

            var mostUsedCount = GetMostUsedChar(chars).Count();

            ConsoleFactory.Log($"Most used character: {mostUsed} ({mostUsedCount} times)");
        }
コード例 #2
0
        public static void DisplayMostUsedWord(string sentence)
        {
            var words = sentence.RemoveExtraSpaces().RemoveBreakReturns();

            var mostUsed = GetMostUsedWord(words).Key;

            var mostUsedCount = GetMostUsedWord(words).Count();

            ConsoleFactory.Log($"Most used word: {mostUsed} ({mostUsedCount} times)");
        }
コード例 #3
0
        public static void DisplayTotalCharacters(string sentence)
        {
            var chars = sentence.RemoveBreakReturns();

            ConsoleFactory.Log($"Total Characters: {chars.Length}");
        }
コード例 #4
0
        public static void DisplayCharacterCount(string sentence)
        {
            var chars = sentence.StripAll();

            ConsoleFactory.Log($"Character count (minus line returns and spaces): {chars.Length}");
        }
コード例 #5
0
        public static void DisplayTotalWords(string sentence)
        {
            var words = sentence.RemoveExtraSpaces().Split(' ');

            ConsoleFactory.Log($"Total Words: {words.Length}");
        }