Пример #1
0
        public static SequencedString operator +(SequencedString s1, SequencedString s2)
        {
            SequencedString newstr = new SequencedString(s1.Length + s2.Length);

            newstr.Concat(s1);
            newstr.Concat(s2);
            return(newstr);
        }
Пример #2
0
        public SequencedString Remove(int i, int n)
        {
            SequencedString sub1, sub2, sub3;

            sub1 = this.Substring(0, i);
            sub2 = this.Substring(i, n);
            sub3 = this.Substring(i + n, this.Length - i - n);
            SequencedString newstr = new SequencedString(items.Length);

            newstr.Concat(sub1);
            newstr.Concat(sub3);
            return(newstr);
        }
Пример #3
0
        public SequencedString Insert(int i, char c)
        {
            SequencedString sub1, sub2;

            sub1 = this.Substring(0, i);
            sub2 = this.Substring(i, this.Length - i);
            SequencedString newstr = new SequencedString(items.Length + 8);

            newstr.Concat(sub1);
            newstr.Concat(c);
            newstr.Concat(sub2);
            return(newstr);
        }
Пример #4
0
        public SequencedString Replace(SequencedString oldsub, SequencedString newsub)
        {
            int             i, n;
            SequencedString sub1, sub3;
            SequencedString newstr = new SequencedString(items.Length + newsub.Length);

            i = this.IndexOf(oldsub);
            if (i != -1)
            {
                sub1 = this.Substring(0, i);
                n    = oldsub.Length;
                sub3 = this.Substring(i + n, this.Length - i - n);
                newstr.Concat(sub1);
                newstr.Concat(newstr);
                newstr.Concat(sub3);
            }
            return(newstr);
        }
Пример #5
0
        public SequencedString Reverse()
        {
            int             i;
            SequencedString newstr = new SequencedString(items.Length);

            for (i = this.Length - 1; i >= 0; i--)
            {
                newstr.Concat(this.items[i]);
            }
            return(newstr);
        }