예제 #1
0
            static void Main(string[] args)
            {
                StringFormatting myFormatter = new StringFormatting();

                // now you can call the methods


                Console.WriteLine("Enter your string to test");

                String userTest = Console.ReadLine();

                Console.WriteLine("Testing stringSeparator");
                Console.WriteLine("The result was : {0}", myFormatter.stringSeparator(userTest));

                Console.WriteLine("Testing stringReverse");
                Console.WriteLine("The result was : {0}", myFormatter.stringReverse(userTest));

                Console.WriteLine("Enter your second string");
                String userTest2 = Console.ReadLine();

                int result = myFormatter.stringCompare(userTest, userTest2);

                switch (result)
                {
                case -1:
                    Console.WriteLine("The strings are unequal");
                    break;

                case 0:
                    Console.WriteLine("The length of both strings are equal");
                    break;

                case 1:
                    Console.WriteLine("The length of both strings are equal");
                    Console.WriteLine("And also, both strings are equal.");
                    break;

                default:
                    Console.WriteLine("Something weird happened");
                    break;
                }

                Console.WriteLine("The number of vowels in first string are {0}", myFormatter.sumVowels(userTest));
                Console.WriteLine("The number of consonants in first string are {0}", myFormatter.sumConsonants(userTest));

                // delay disposal of window
                Console.ReadLine();
            }