Beispiel #1
0
        static void Main(string[] args)
        {
            string testovaciText = "Toto je retezec predstavovany nekolika radky,\n"
                                   + "ktere jsou od sebe oddeleny znakem LF (Line Feed).\n"
                                   + "Je tu i nejaky ten vykricnik! Pro ucely testovani i otaznik?\n"
                                   + "Toto je jen zkratka zkr. ale ne konec vety. A toto je\n"
                                   + "posledni veta! covid";
            StringStatistics a = new StringStatistics(testovaciText);

            Console.WriteLine("Number of words : " + a.WordCount());
            Console.WriteLine("Number of lines : " + a.LineCount());
            Console.WriteLine("Number of sentences : " + a.SentenceCount());
            Console.WriteLine("Longest Words : " + String.Join(", ", a.LongestWords()));
            Console.WriteLine("Shortest Words : " + String.Join(", ", a.ShortestWords()));
            Console.WriteLine("Most Common word : " + String.Join(", ", a.CommonWords()));
            Console.WriteLine("Sorted words : " + String.Join(", ", a.AlphSort()));
            Console.WriteLine("Is infected : " + a.IsInfected());
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string testText = "Toto je retezec predstavovany nekolika radky,\n"
                              + "ktere jsou od sebe oddeleny znakem LF (Line Feed).\n"
                              + "Je tu i nejaky ten vykricnik! Pro ucely testovani i otaznik?\n"
                              + "Toto je jen zkratka zkr. ale ne konec vety. A toto je\n"
                              + "posledni veta! Ahoj, máš covid?";
            StringStatistics stringStatistics = new StringStatistics(testText);

            string[] splittedText = stringStatistics.SplitStringToArray();


            Console.WriteLine("Number of worlds: {0}", stringStatistics.NumOfWords());
            Console.WriteLine("Number of sentences is:{0} ", stringStatistics.NumOfSentences());
            Console.WriteLine("Number of rows is:{0}", stringStatistics.NumOfRows());
            Console.Write("Longest words: ");
            foreach (string s in stringStatistics.LongestWords())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            Console.Write("Shortest words: ");
            foreach (string s in stringStatistics.ShortestWords())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            Console.Write("Most common words: ");
            foreach (string s in stringStatistics.MostCommonWords())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            Console.Write("Alphabeticaly ordered words: ");
            foreach (string s in stringStatistics.SortText())
            {
                Console.Write(s + ", ");
            }
        }