Esempio n. 1
0
        private static void PrintWord()
        {
            Console.Clear();

            Console.WriteLine("This program will print out any word in your inputed string");
            int  nth           = 1;
            bool CorrectNumber = true;

            do
            {
                Console.Write("Input the index of word you want to print: ");
                CorrectNumber = int.TryParse(Console.ReadLine(), out nth);
                if (!CorrectNumber || nth <= 0)
                {
                    Console.WriteLine("Invalid number inputted");
                }
            } while (!CorrectNumber || nth <= 0);


            Console.Write("Please input your string with more than " + nth + " words:");
            string             input = Console.ReadLine();
            StringManipulation str   = new StringManipulation();

            str.MainString = input;
            Console.WriteLine("The " + nth + " words: " + str.FindWord(nth));
            Console.ReadLine();
        }
Esempio n. 2
0
        private static void PrintTenString()
        {
            Console.Clear();
            Console.WriteLine("This program will print out your inputed string ten times");
            Console.Write("Please input your string:");
            string             input = Console.ReadLine();
            StringManipulation str   = new StringManipulation();

            str.MainString = input;
            str.PrintString();
        }