コード例 #1
0
        static void Main(string[] args)
        {
            StringDS s = new StringDS("I am isscuss");

            StringDS i = new StringDS("nice");

            StringDS r = new StringDS("student");

            StringDS a = new StringDS("iss");

            Console.WriteLine(s.GetLength());

            Console.WriteLine(i.GetLength());

            Console.WriteLine(r.GetLength());

            StringDS s2 = s.SubString(8, 4);

            Console.WriteLine(s2.ToString());

            StringDS s3 = i.SubString(2, 1);

            Console.WriteLine(s3.ToString());

            Console.WriteLine(s.IndexOf(a));

            Console.ReadKey();
        }
コード例 #2
0
        public void exercises()
        {
            StringDS s  = new StringDS("i am cccc");
            StringDS c  = new StringDS("am cc");
            StringDS r  = new StringDS(" bbb");
            int      di = 0;

            while (true)
            {
                di++;
                int i = s.IndexOf(c);
                Console.WriteLine(s[i]);
                s[i] = r[2];
                Console.WriteLine(s[i]);
                if (di == s.GetLength())
                {
                    break;
                }
            }
        }