示例#1
0
        static void Main(string[] args)
        {
            //SystemString Tests
            SystemString test1 = new SystemString("the");

            // test1.Insert(2, "adam");
            Console.WriteLine(test1);

            //SystemArrayString Tests
            SystemArrayString test2 = new SystemArrayString("Hello");

            Console.WriteLine(test2.ToString());
            //test2.Insert(0, "CHECK"); //inserting at far left
            //test2.Insert(5, "CHECK"); //inserting at far right
            //test2.Insert(2, "CHECK"); //inserting in the middle
            //test2.Remove(3, 2); //removing final letters
            //test2.Remove(0, 2); //removing at start
            //test2.Remove(0, 5); //removing all letters
            //test2.Remove(1, 3); //removing some letters
            Console.WriteLine(test2.ToString());

            //SystemLinkedListString Tests
            SystemLinkedListString test3 = new SystemLinkedListString("Adam");

            Console.WriteLine(test3.ToString());
            //test3.Insert(0, "CHECK"); //inserting at far left
            //test3.Insert(4, "CHECK"); //inserting at far right
            //test3.Insert(2, "CHECK"); //inserting in the middle
            //test3.Remove(4, 5);
            //test3.Remove(2, 2); //removing final letters
            //test3.Remove(0, 2); //removing at start
            //test3.Remove(0, 4); //removing all letters
            //test3.Remove(1, 3); //removing some letters;
            Console.WriteLine(test3.ToString());
            //Console.WriteLine(test3.Length());

            //CustomLinkedList
            CustomLinkedListString test4 = new CustomLinkedListString("Follmer");

            Console.WriteLine(test4.ToString());
            //test4.Insert(0, "CHECK"); //inserting at far left
            //test4.Insert(7, "CHECK"); //inserting at far right
            //test4.Insert(2, "CHECK"); //inserting in the middle
            //test4.Remove(5, 2); //removing final letters
            //test4.Remove(0, 2); //removing at start
            //test4.Remove(0, 7); //removing all letters
            //test4.Remove(1, 3); //removing some letters;
            Console.WriteLine(test4.ToString());

            //Systems.Collections.SortedList
            //SortedList<int, ICustomString> sortedStringList = new SortedList<int, ICustomString>();
            //sortedStringList.Add(test1.Length(), test1);
            //sortedStringList.Add(test2.Length(), test2);
            //sortedStringList.Add(test3.Length(), test3);
            //sortedStringList.Add(test4.Length(), test4);
            //for (int i = 0; i < sortedStringList.Count; i++)
            //{
            //    Console.WriteLine("{0}. {1}", i, sortedStringList.ElementAt(i));
            //}

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            /////////////////////////////////////////////////////////////////////////
            //////////////////  TEST THE sYSTEM "string" CLASS//////////
            ////////////////////////////////////////////////////////////
            SystemString myString = new SystemString("This is the SYSTEM \"string\".");
            Console.WriteLine(myString);
            Console.ReadLine();
            myString.Insert("Add More to this is it");
            Console.WriteLine(myString);
            Console.ReadLine();
            myString.Remove(39, 8);         //AT POSITION 39 REMOVE 4 CHARATERS
            Console.WriteLine(myString);
            Console.ReadLine();
            ////////////////////////////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////

            ////////////////////////////////////////////////////////////////////////
            /////////////////// TEST THE CUSTOM LINKEDLISTSTRING ///////
            ////////////////////////////////////////////////////////////
            CustomLinkedListString myLinkedString = new CustomLinkedListString("This is char Custom string linked listed.");
            Console.WriteLine(myLinkedString.ToString());
                    ////////  TEST THE "INSERT" METHOD ///////////////
            myLinkedString.Insert(" Just added some more.");
            Console.WriteLine(myLinkedString.ToString());
            Console.ReadLine();
            myLinkedString.Remove(39, 8);         //AT POSITION 39 REMOVE 4 CHARATERS
            Console.WriteLine(myLinkedString);
            Console.ReadLine();
            ////////////////////////////////////////////////////////////////////////

            ////////////////////////////////////////////////////////////////////////
            //////////////// TEST THE SYSTEM "LinkedList" ///////////
            ////////////////////////////////////////////////////////////
            SystemLinkedListString MySysLinkedLIst = new SystemLinkedListString(" This is a char System \"LinkedList\".");
            Console.WriteLine(MySysLinkedLIst.ToString());
            MySysLinkedLIst.Insert(" Adding to the linked list");
            Console.WriteLine(MySysLinkedLIst.ToString());
            MySysLinkedLIst.Remove(4, 3);
            Console.WriteLine(MySysLinkedLIst.ToString());
            Console.ReadLine();
            ////////////////////////////////////////////////////////////////////////

            ////////////////////////////////////////////////////////////////////////
            //////////////// TEST THE SYSTEM "ARRAY List" ///////////
            ////////////////////////////////////////////////////////////
            SystemArrayString MySysArrayList = new SystemArrayString("This is an array list.");
            Console.WriteLine(MySysArrayList.ToString());
            MySysArrayList.Insert(" Adding to the Array");
            Console.WriteLine(MySysArrayList.ToString());
            MySysArrayList.Remove(12, 3);
            Console.WriteLine(MySysArrayList.ToString());

            Console.ReadLine();

            ////////////////////////////////////////////////////////////////////////

            //System.Collections.SortedList SysColSL = new System.Collections.SortedList();

            //System.Collections.SortedList<ICustomString> SysSLICustomS = new System.Collections.SortedList<ICustomString>();
        }