public static void Main(string[] args)
        {
            var data   = new TextSort();
            var result = data.SortByAlphabetical("without,hello,bag,world  ");

            Console.WriteLine(result);
            var xxx = GetHomework01Result("without,hello,bag,world  ");

            Console.WriteLine(xxx);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            TextSorter sorter      = new TextSorter();
            TextSort   TextToUpper = new TextSort(sorter.ToUpperCase);
            TextSort   TextToLower = new TextSort(sorter.ToLowerCase);
            TextSort   TextToTitle = new TextSort(sorter.ToTitle);
            TextSort   ReverseText = new TextSort(sorter.Reverse);

            bool loop = true;

            while (loop)
            {
                Console.WriteLine("Anna tekstiä:");
                string text = Console.ReadLine();
                Console.WriteLine();
                Console.WriteLine("Mitä haluat tekstille tehtävän?");
                Console.WriteLine("1) KAIKKI KOLOSSAALISEKSI");
                Console.WriteLine("2) kaikki pienellä");
                Console.WriteLine("3) Alkukirjaimet Isoiksi");
                Console.WriteLine("4) nirepakat");
                Console.WriteLine("0) lopettaa");
                Console.WriteLine();
                string operations = Console.ReadLine();

                switch (operations)
                {
                case "0":
                    loop = false;
                    break;

                case "1":
                    Console.WriteLine(TextToUpper(text));
                    Console.WriteLine();
                    break;

                case "2":
                    Console.WriteLine(TextToLower(text));
                    Console.WriteLine();
                    break;

                case "3":
                    Console.WriteLine(TextToTitle(text));
                    Console.WriteLine();
                    break;

                case "4":
                    Console.WriteLine(ReverseText(text));
                    Console.WriteLine();
                    break;
                }
            }
        }
        static void Main(string[] args)
        {
            var datawork01 = "without,hello,bag,world";
            var datawork02 = "34,67,55,33,12,28";
            var textSort   = new TextSort();
            var data01     = textSort.SortByAlphabetical(datawork01);

            Console.WriteLine(new string('=', 40));
            Console.WriteLine("HomeWork01");
            Console.WriteLine("Data01 : " + datawork01);
            Console.WriteLine(data01);
            Console.WriteLine(new string('=', 40));
            Console.WriteLine("HomeWork02");
            var textMultiplier = new TextMultiplier();
            var data02         = textMultiplier.GetFormattedString(datawork02);

            Console.WriteLine("Data02 : " + datawork02);
            Console.WriteLine(data02);
        }