Пример #1
0
        public MyString Remove(int startID, int count)
        {
            MyString result = new MyString(this.Length - count);

            for (int i = 0; i < startID; i++)
            {
                result[i] = this.chars[i];
            }

            int j = startID;

            for (int i = startID + count; i < this.Length; i++)
            {
                result[j] = this.chars[i];
                j++;
            }

            return(result);
        }
Пример #2
0
        public bool Compare(MyString str)
        {
            if (this.Length != str.Length)
            {
                return(false);
            }
            else
            {
                for (var i = 0; i < this.Length; i++)
                {
                    if (this.charArray[i] != str[i])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Пример #3
0
        public static MyString Concat(MyString str0, MyString str1, MyString str2)
        {
            char[] str3 = new char[str0.StrLength + str1.StrLength + str2.StrLength];

            for (int i = 0; i < str0.StrLength; i++)
            {
                str3[i] = str0[i];
            }

            for (int i = 0; i < str1.StrLength; i++)
            {
                str3[i + str0.StrLength] = str1[i];
            }

            for (int i = 0; i < str2.StrLength; i++)
            {
                str3[i + str0.StrLength + str1.StrLength] = str2[i];
            }

            return(new MyString(str3));
        }
Пример #4
0
        public bool Contains(MyString b)
        {
            for (int i = 0; i < this.Length - b.Length + 1; i++)
            {
                bool result = true;
                for (int j = i; j < b.Length; j++)
                {
                    if (this.chars[j] != b[j - i])
                    {
                        result = false;
                        break;
                    }
                }

                if (result)
                {
                    return(result);
                }
            }

            return(false);
        }
Пример #5
0
        public static MyString operator +(MyString obj1, MyString obj2)
        {
            char[] newArray = new char[obj1.Array.Length + obj2.Array.Length];
            int    counter  = 0;

            for (int i = 0; i < obj1.Array.Length; i++)
            {
                newArray[counter] = obj1.Array[i];
                counter++;
            }

            for (int i = 0; i < obj1.Array.Length; i++)
            {
                newArray[i] = obj2.Array[i];
                counter++;
            }

            MyString tempObj = new MyString
            {
                Array = newArray
            };

            return(tempObj);
        }
Пример #6
0
        public MyString Insert(int startID, MyString value)
        {
            MyString result = new MyString(this.Length + value.Length);

            for (int i = 0; i < startID; i++)
            {
                result[i] = this.chars[i];
            }

            for (int i = 0; i < value.Length; i++)
            {
                result[startID + i] = value[i];
            }

            int j = startID;

            for (int i = startID + value.Length; i < result.Length; i++)
            {
                result[i] = this.chars[j];
                j++;
            }

            return(result);
        }
Пример #7
0
        /// <summary>
        /// ConCat MyString with another string
        /// </summary>
        /// <param name="str">another string</param>
        /// <returns>new MyString</returns>
        public MyString ConCat(MyString str)
        {
            MyString result = new MyString(this.massiveChar.Concat(str.massiveChar).ToArray());

            return(result);
        }
Пример #8
0
        public static void Main(string[] args)
        {
            Console.Write("Print your string: ");
            string   str      = Console.ReadLine();
            int      length   = str.Length;
            MyString myString = new MyString(length);

            for (int i = 0; i < str.Length; i++)
            {
                myString[i] = str[i];
            }

            myString.ShowCharArray();
            Console.WriteLine("Length of your string is {0}", myString.MyLength());
            Console.Write("Print symbol you want to find: ");
            char symbol = Console.ReadKey().KeyChar;

            Console.WriteLine();
            Console.WriteLine("Index of your symbol is {0}", myString.MyIndexOf(symbol));
            Console.WriteLine("Last index of your symbol is {0}", myString.MyLastIndexOf(symbol));
            Console.Write("Print another string: ");
            str    = Console.ReadLine();
            length = str.Length;
            MyString myString2 = new MyString(length);

            for (int i = 0; i < str.Length; i++)
            {
                myString2[i] = str[i];
            }

            myString.MyConcat(myString2);
            Console.Write("After concatenation: ");
            myString.ShowCharArray();
            Console.WriteLine("Comparasion of two strings {0}", myString.MyCompare(myString2));
            Console.Write("Print symbol you want to delete: ");
            symbol = Console.ReadKey().KeyChar;
            Console.WriteLine();
            myString.MyDelete(symbol);
            Console.WriteLine("After deletion: ");
            myString.ShowCharArray();
            Console.Write("Print symbol you want to insert: ");
            symbol = Console.ReadKey().KeyChar;
            Console.WriteLine();
            Console.Write("Print position: ");
            int  pos;
            bool check = int.TryParse(Console.ReadLine(), out pos);

            while (!check || pos < 0 || pos >= myString.MyLength())
            {
                Console.WriteLine("Wrong position, try again");
                check = int.TryParse(Console.ReadLine(), out pos);
            }

            myString.MyInsert(symbol, pos);
            Console.WriteLine("After insertion:");
            myString.ShowCharArray();
            StringBuilder sb = myString.MyToString();

            Console.WriteLine("ToString: {0}", sb);
            myString.MyToCharArray(sb);
            Console.Write("To charArray: ");
            myString.ShowCharArray();
        }
Пример #9
0
 private static void Main(string[] args)
 {
     MyString myString1 = new MyString("My String");
     MyString myString2 = new MyString("my String");
 }
Пример #10
0
        private static void Main()
        {
            Console.WriteLine("Greetings! In this program you will see MyString class demonstration.");
            Console.WriteLine();

            Console.WriteLine("Class has three constructors.");
            Console.WriteLine("First constructor takes char array as a parameter: MyString(chars).");
            char[] chars = { 'H', 'e', 'l', 'l', 'o' };
            Console.Write("Char array has: ");

            foreach (char ch in chars)
            {
                Console.Write(ch + ", ");
            }

            MyString myString = new MyString(chars);

            Console.WriteLine($"Value of MyString instance is: {myString}");
            Console.WriteLine();

            Console.WriteLine("Second constructor takes char array from start index in array to length: MyString(char, 2, 3).");

            myString = new MyString(chars, 2, 3);
            Console.WriteLine($"New value of MyString instance is: {myString}");
            Console.WriteLine();

            Console.WriteLine("Third constructor takes specified char as first parameter and integer as a count: MyString('a', 5).");
            myString = new MyString('a', 5);
            Console.WriteLine($"New value of MyString instance is: {myString}");
            Console.WriteLine();

            Console.WriteLine("To get a specified char from MyString instance by index use indexer: myString[int index].");

            myString = new MyString(chars);
            Console.WriteLine($"Value of MyString instance: {myString}");

            Console.WriteLine($"The char form MyString instance by index 1 'myString[1]': {myString[1]}");
            Console.WriteLine();

            Console.WriteLine("Static Concat method has 4 overloads, can take as paramenters: one, two, three object instances or object array.");

            object obj = "Hi ";

            Console.WriteLine($"Object instance: {obj.ToString()}");

            myString = MyString.Concat(obj);
            Console.WriteLine($"myString = MyString.Concat(obj): {myString}");

            object obj1 = 4;

            Console.WriteLine($"Second object instance: {obj1.ToString()}");

            myString = MyString.Concat(obj, obj1);
            Console.WriteLine($"myString = MyString.Concat(obj, obj1): {myString}");

            object obj2 = " times";

            Console.WriteLine($"Third object instance: {obj2.ToString()}");

            myString = MyString.Concat(obj, obj1, obj2);
            Console.WriteLine($"myString = MyString.Concat(obj, obj1, obj2): {myString}");

            object obj3 = " again";

            object[] objects =
            {
                obj,
                obj1,
                obj2,
                obj3
            };

            myString = MyString.Concat(objects);
            Console.WriteLine($"myString = MyString.Concat(objects): {myString}");
            Console.WriteLine();

            Console.WriteLine("Concat method has same 4 overloads with MyString type.");
            Console.WriteLine();

            Console.WriteLine("Contains method defines if MyString instance contains another MyString instance: bool Contains(MyString value).");
            MyString ms = "times";

            Console.WriteLine($"'{myString}' contains '{ms}': {myString.Contains(ms)}");
            Console.WriteLine();

            Console.WriteLine("Static method MyString.Copy(MyString value) returns a copy of value instance.");

            MyString copy = MyString.Copy(myString);

            Console.WriteLine($"Value of myString: {myString}");
            Console.WriteLine($"Value of copy: {copy}");
            Console.WriteLine($"Object.ReferenceEquals(myString, copy): {object.ReferenceEquals(myString, copy)}");
            Console.WriteLine();

            char[] destination = new char[4];
            myString.CopyTo(5, destination, 0, 4);
            Console.WriteLine("Void CopyTo(int sourceIndex, char[] destintion, int destionationIndex, int count) copies specified part of chars in MyString instance to char array.");
            Console.Write("After 'myString.CopyTo(5, destination, 0, 4)' destination array contents: ");
            foreach (char ch in destination)
            {
                Console.Write(ch + ", ");
            }

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("EndsWith method serves to find out if MyString instance ends with another MyString instance: bool EndsWith(value).");
            Console.WriteLine($"Value of myString: {myString}");
            MyString addString = "again";

            Console.WriteLine($"Value of addString: {addString}");
            Console.WriteLine($"myString ends with addString - myString.EndsWith(addString): {myString.EndsWith(addString)}");
            Console.WriteLine();

            Console.WriteLine("There is three overloads for IndexOf method:");
            Console.WriteLine($"int IndexOf(char) - myString.IndexOf('i'): {myString.IndexOf('i')}");
            Console.WriteLine($"int IndexOf(char, startIndex) - myString.IndexOf('i', 5): {myString.IndexOf('i', 5)}");
            Console.WriteLine($"int IndexOf(char, startIndex, count) - myString.IndexOf('i', 7, 4): {myString.IndexOf('i', 7, 4)}");
            Console.WriteLine();

            Console.WriteLine("Three overloads for IndexOf method taking MyString instance as a parameter:");
            Console.WriteLine($"myString.IndexOf(addString): {myString.IndexOf(addString)}");
            Console.WriteLine($"myString.IndexOf(addString, 11): {myString.IndexOf(addString, 11)}");
            Console.WriteLine($"myString.IndexOf(addString, 10, 5): {myString.IndexOf(addString, 10, 5)}");
            Console.WriteLine();

            Console.WriteLine("There is three overloads for IndexOfAny method taking char array as a parameter to search:");
            chars = new char[] { 't', 'H', 'i' };
            Console.Write("Char array named 'chars' has: ");
            foreach (char ch in chars)
            {
                Console.Write(ch + ", ");
            }

            Console.WriteLine();
            Console.WriteLine($"myString.IndexOfAny(chars): {myString.IndexOfAny(chars)}");
            Console.WriteLine($"myString.IndexOfAny(chars, 3): {myString.IndexOfAny(chars, 3)}");
            Console.WriteLine($"myString.IndexOfAny(chars, 7, 5): {myString.IndexOfAny(chars, 7, 5)}");
            Console.WriteLine();

            Console.WriteLine("Insert method takes an integer as a start index and MyString value to insert to calling MyString instance. Reternes new MyString instance:");
            MyString insertMS = "again ";

            Console.WriteLine($"Value to insert: '{insertMS}'");
            myString = myString.Insert(11, insertMS);
            Console.WriteLine($"myString = myString.Insert(11, insertMS): {myString}");
            Console.WriteLine();

            Console.WriteLine("There is three overloads for LastIndexOf method:");
            Console.WriteLine($"myString.LastIndexOf('g'): {myString.LastIndexOf('g')}");
            Console.WriteLine($"myString.LastIndexOf('g', 16): {myString.LastIndexOf('g', 16)}");
            Console.WriteLine($"myString.LastIndexOf('g', 16, 3): {myString.LastIndexOf('g', 16, 3)}");

            Console.WriteLine("Three overloads for LastIndexOf method taking MyString instance as a parameter:");
            Console.WriteLine($"myString.LastIndexOf(addString): {myString.LastIndexOf(addString)}");
            Console.WriteLine($"myString.LastIndexOf(addString, 11): {myString.LastIndexOf(addString, 16)}");
            Console.WriteLine($"myString.LastIndexOf(addString, 10, 5): {myString.LastIndexOf(addString, 16, 5)}");
            Console.WriteLine();

            Console.WriteLine("There is three overloads for LastIndexOfAny method taking char array as a parameter to search:");
            Console.Write("Char array named 'chars' has: ");
            foreach (char ch in chars)
            {
                Console.Write(ch + ", ");
            }

            Console.WriteLine();
            Console.WriteLine($"myString.LastIndexOfAny(chars): {myString.LastIndexOfAny(chars)}");
            Console.WriteLine($"myString.LastIndexOfAny(chars, 3): {myString.LastIndexOfAny(chars, 3)}");
            Console.WriteLine($"myString.LastIndexOfAny(chars, 7, 5): {myString.LastIndexOfAny(chars, 7, 5)}");
            Console.WriteLine();

            Console.WriteLine("Remove method has two overloads - remove from start index to end of MyString instance and remove from start count chars. Reterns new MyString instance:");
            myString = myString.Remove(10, 6);
            Console.WriteLine($"myString = myString.Remove(10, 6): '{myString}'");
            myString = myString.Remove(10);
            Console.WriteLine($"myString = myString.Remove(10): '{myString}'");
            Console.WriteLine();

            Console.WriteLine("There is two overloads for Replace method - first replaces old char for new char int whole MyString instance ind second replaces old MyString value to new MyString value. Returns new MyString instance:");
            myString = "Hi bi mi bi";
            Console.WriteLine($"Value of myString: '{myString}'");
            myString = myString.Replace('i', 'e');
            Console.WriteLine($"Value after myString = myString.Replace('i', 'e'): '{myString}'");
            MyString oldValue = "be";

            Console.WriteLine($"MyString instance to be changed (oldValue): '{oldValue}'");
            MyString newValue = "big";

            Console.WriteLine($"MyString instance which is to replace the old value (newValue): '{newValue}'");
            myString = myString.Replace(oldValue, newValue);
            Console.WriteLine($"After myString = myString.Replace(oldValue, newValue): '{myString = myString.Replace(oldValue, newValue)}'");

            Console.WriteLine("StartsWith method defines if MyString instance starts with specified MyString value:");
            MyString startsWith = "He";

            Console.WriteLine($"MyString instance to compare 'startWith' named: '{startsWith}'");
            Console.WriteLine($"myString.StartsWith(startsWith): {myString.StartsWith(startsWith)}");
            Console.WriteLine();

            Console.WriteLine("There is two overloads for SubMyString method - from start index to end of MyString instance and from start index to count. Returns new MyString instance:");
            Console.WriteLine($"myString.SubMyString(3): '{myString.SubMyString(3)}'");
            Console.WriteLine($"myString.SubMyString(3, 3): '{myString.SubMyString(3, 3)}'");
            Console.WriteLine();

            Console.WriteLine($"ToLower method returns new MyString instance with all lower case chars: '{myString.ToLower()}'");
            Console.WriteLine($"And ToUpper method with all upper case chars: '{myString.ToUpper()}'");
            Console.WriteLine();

            Console.WriteLine($"ToCharArray method returns char array with all chars form MyString instance: chars = myString.ToCharArray(){chars = myString.ToCharArray()}");
            Console.Write("Chars array consists of: ");
            foreach (char ch in chars)
            {
                Console.Write(ch + ", ");
            }

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("There is implicit casts from MyString to string, from string to MyString, from MyString to StringBuilder, from StringBuilder to MyString.");
            Console.WriteLine();

            Console.WriteLine("Also ToString(), GetHashCode() overrided methods, IEquatable<MyString>, IComparable<MyString> and IComparable implementation, '==' and '!=' operatiors.");

            MyString ms1 = "Hello";
            MyString ms2 = "Hello";

            Console.WriteLine($"MyString instance named ms1: '{ms1}'");
            Console.WriteLine($"MyString instance named ms2: '{ms2}'");
            Console.WriteLine($"Object.ReferenceEquals(ms1, ms2): {object.ReferenceEquals(ms1, ms2)}");
            Console.WriteLine($"ms1.Equals(ms2): {ms1.Equals(ms2)}");
            Console.WriteLine();
        }
Пример #11
0
        public static void Main(string[] args)
        {
            string stringstr1;

            Console.Write($"Welcom to MyString Test Application{Environment.NewLine}Enter string line: ");
            stringstr1 = Console.ReadLine();
            MyString mystr1 = new MyString(stringstr1);

            Console.WriteLine($"MyString from string line is: {mystr1}{Environment.NewLine}It's length is {mystr1.Length}{Environment.NewLine}");

            Console.Write("Enter another two MyString lines to compare them. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            MyString mystr2 = new MyString(Console.ReadLine());

            switch (MyString.Compare(mystr1, mystr2))
            {
            case 1:
                Console.WriteLine("First one is bigger");
                break;

            case -1:
                Console.WriteLine("Second one is bigger");
                break;

            case 0:
                Console.WriteLine("They are the same");
                break;
            }

            Console.WriteLine();

            Console.Write("Enter another two MyString lines to concatenate them. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            Console.WriteLine($"The concatenation is: {MyString.Concat(mystr1, mystr2)}");
            Console.WriteLine();

            Console.Write("Enter another two MyString lines to find out, if they are equal. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            if (mystr1.Equals(mystr2))
            {
                Console.WriteLine("They are equal");
            }
            else
            {
                Console.WriteLine("They are not equal");
            }

            Console.WriteLine();

            Console.Write("Enter another two MyString lines to find if the first contains second. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            if (mystr1.Contains(mystr2))
            {
                Console.WriteLine("It does");
            }
            else
            {
                Console.WriteLine("It doesn't");
            }

            Console.WriteLine();

            Console.Write("Enter another two MyString lines to find if the first starts with second. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            if (mystr1.StartsWith(mystr2))
            {
                Console.WriteLine("It does");
            }
            else
            {
                Console.WriteLine("It doesn't");
            }

            Console.WriteLine();

            Console.Write("Enter another two MyString lines to find if the first ends with second. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            if (mystr1.EndsWith(mystr2))
            {
                Console.WriteLine("It does");
            }
            else
            {
                Console.WriteLine("It doesn't");
            }

            Console.WriteLine();

            Console.Write("Enter MyString to find the index of a sybmbol. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Sybmbol: ");
            char symbol = char.Parse(Console.ReadLine());

            if (mystr1.IndexOf(symbol) == -1)
            {
                Console.WriteLine("There is no such symbol");
            }
            else
            {
                Console.WriteLine(mystr1.IndexOf(symbol));
            }

            Console.WriteLine();

            Console.Write("Enter MyString to find the last index of a sybmbol. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Sybmbol: ");
            symbol = char.Parse(Console.ReadLine());
            if (mystr1.LastIndexOf(symbol) == -1)
            {
                Console.WriteLine("There is no such symbol");
            }
            else
            {
                Console.WriteLine(mystr1.LastIndexOf(symbol));
            }

            Console.WriteLine();

            Console.Write("Enter MyString to find the first index of any symbol in char array. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Sybmbols: ");
            char[] symbols = Console.ReadLine().ToCharArray();
            if (mystr1.IndexOfAny(symbols) == -1)
            {
                Console.WriteLine("There is no such symbols");
            }
            else
            {
                Console.WriteLine(mystr1.IndexOfAny(symbols));
            }

            Console.WriteLine();

            Console.Write("Enter MyString to find the last index of any symbol in char array. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Sybmbols: ");
            symbols = Console.ReadLine().ToCharArray();
            if (mystr1.LastIndexOfAny(symbols) == -1)
            {
                Console.WriteLine("There is no such symbols");
            }
            else
            {
                Console.WriteLine(mystr1.LastIndexOfAny(symbols));
            }

            Console.WriteLine();

            Console.Write("Enter MyString to make it to upper: ");
            mystr1 = new MyString(Console.ReadLine());
            mystr1.ToUpper();
            Console.WriteLine($"The result is: {mystr1}");
            Console.WriteLine();

            Console.Write("Enter MyString to make it to lower: ");
            mystr1 = new MyString(Console.ReadLine());
            mystr1.ToLower();
            Console.WriteLine($"The result is: {mystr1}");
            Console.WriteLine();

            Console.Write("Enter another two MyString lines and position to insert second in the first. First one: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Second one: ");
            mystr2 = new MyString(Console.ReadLine());
            Console.Write("Position: ");
            int position = int.Parse(Console.ReadLine());

            Console.WriteLine($"The result is: {mystr1.Insert(position, mystr2)}");
            Console.WriteLine();

            Console.Write("Enter another MyString line and start and end positions to remove elements. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Start: ");
            position = int.Parse(Console.ReadLine());
            Console.Write("End: ");
            int position1 = int.Parse(Console.ReadLine());

            Console.WriteLine($"The result is: {mystr1.Remove(position, position1)}");
            Console.WriteLine();

            Console.Write("Enter another MyString line and start and end positions to generate SubMyString. MyString: ");
            mystr1 = new MyString(Console.ReadLine());
            Console.Write("Start: ");
            position = int.Parse(Console.ReadLine());
            Console.Write("End: ");
            position1 = int.Parse(Console.ReadLine());
            Console.WriteLine($"The result is: {mystr1.SubMyString(position, position1)}");
            Console.WriteLine();
        }
Пример #12
0
        public static void Main(string[] args)
        {
            string s1    = "First string";
            string s2    = "Second string";
            string s3    = "First string";
            string s4    = "rst stri";
            string arrow = " => ";
            char   l     = 'l';
            char   dot   = '.';

            char[] charArray = s3.ToCharArray();

            MyString myStr1 = new MyString(s1);
            MyString myStr2 = new MyString(s2);
            MyString myStr3 = new MyString(charArray);

            int comp1 = myStr1.Compare(myStr2);
            int comp2 = myStr1.Compare(s3);

            bool b1 = myStr1.Contains(l);
            bool b2 = myStr1.Contains(s4);
            bool b3 = myStr1.Contains(myStr3);

            MyString myStr4 = myStr1.Concat('.');
            MyString myStr5 = myStr1.Concat(" => ");
            MyString myStr6 = myStr1.Concat(myStr2);

            MyString myStr7 = myStr1 + myStr3;

            {
                Console.WriteLine("Some work with class \"MyString\"");
                Console.WriteLine(Environment.NewLine);

                Console.WriteLine($"{nameof(myStr1)} = {myStr1}");
                Console.WriteLine($"{nameof(myStr2)} = {myStr2}");
                Console.WriteLine($"{nameof(myStr3)} = {myStr3}");

                Console.WriteLine(Environment.NewLine);
                Console.WriteLine($"{nameof(myStr1)} is bigger (1), smaller (2) or equal (0) to {nameof(myStr2)}: {comp1}");
                Console.WriteLine($"{nameof(myStr1)} is bigger (1), smaller (2) or equal (0) to {nameof(s3)}: {comp2}");

                Console.WriteLine(Environment.NewLine);
                Console.WriteLine($"{nameof(myStr1)} contains '{l}': {b1}");
                Console.WriteLine($"{nameof(myStr1)} contains \"{s4}\": {b2}");
                Console.WriteLine($"{nameof(myStr1)} contains {nameof(myStr3)}: {b3}");

                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("Sum of MyStrings with Concat():");
                Console.WriteLine($"{nameof(myStr1)} and '{dot}': {myStr4}");
                Console.WriteLine($"{nameof(myStr1)} and \"{arrow}\": {myStr5}");
                Console.WriteLine($"{nameof(myStr1)} and {nameof(myStr2)}: {myStr6}");

                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("Sum of MyStrings with overloaded operator '+':");
                Console.WriteLine($"{nameof(myStr1)} + {nameof(myStr3)}: {myStr7}");

                Console.WriteLine(Environment.NewLine);
                Console.WriteLine($"{nameof(myStr1)}[6] = {myStr1[6]}");
            }

            char[]        charArray2    = myStr1;
            StringBuilder sb            = myStr1;
            string        myStrAsString = (string)myStr1;
            MyString      myStr8        = (MyString)"Test string";
            MyString      mySstr9       = (MyString)charArray;
        }