Beispiel #1
0
        static void Main(string[] args)
        {
            char[][]        text = { "1.erewqr".ToCharArray(), "2.fgdfsg".ToCharArray(),
                                     "3.fdssgdf".ToCharArray(),       "4.fsdtg".ToCharArray(), "5.tgfcfdgxv".ToCharArray() };
            List <SString_> Z = new List <SString_>();

            for (int i = 0; i < 5; i++)
            {
                SString_ X = new SString_(text[i]);
                Z.Add(X);
            }
            Text Q = new Text();

            Q.Init(Z);
            Console.WriteLine("Text");
            Q.Print();
            Console.WriteLine("---------------");
            Console.WriteLine("1.Add line");
            char[]   addline = "6.bcdnhbedj".ToCharArray();
            SString_ newLine = new SString_(addline);

            Q.AddLine(newLine);
            Q.Print();
            Console.WriteLine("-----------------");
            Console.WriteLine("2.Delete line");
            Console.WriteLine("Enter number of line");
            int number = Console.Read();

            Q.Delete(number);
            Console.WriteLine("Text after change");
            Q.Print();
            Console.WriteLine("-----------------");
            Console.WriteLine("3.Bring the characters to uppercase");
            Q.Upper();
            Q.Print();
            Console.WriteLine("------------------");
            char[]   line     = "2.FGDFSG".ToCharArray();
            SString_ newLine1 = new SString_(line);

            Console.WriteLine("4.The number of identical rows");
            Console.WriteLine("Cmp =" + Q.Cmp2(newLine1));
            Console.WriteLine("---------------");
            Console.WriteLine("5.Delete line of a certain length ");
            Console.WriteLine("Enter size");
            int n = Console.Read();

            Q.Delete2(n);
            Q.Print();
            Console.WriteLine("------------");
            Console.WriteLine("6.Clear text");
            Q.ClearAll();
            Q.Print();
            Console.WriteLine("\nClear text");
        }
Beispiel #2
0
        public int Cmp2(SString_ S)
        {
            int count = 0;

            for (int i = 0; i < T.Count(); i++)
            {
                if (T[i].Cmp(S))
                {
                    count++;
                }
            }
            return(count);
        }
Beispiel #3
0
        public bool Cmp(SString_ str)
        {
            if (str.GetSize() != s.Count())
            {
                return(false);
            }
            for (int i = 0; i < s.Count(); i++)
            {
                if (s[i] != str.GetChar(i))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #4
0
 public void AddLine(SString_ S)
 {
     T.Add(S);
 }