static void Main(string[] args) { MySring str = new MySring(new char[] { 'H', 'e', 'l', 'l', 'o', '\0' }); MySring str2 = new MySring(new char[] { 'W', 'o', 'r', 'l', 'd', '\0' }); MySring str3 = new MySring(new char[] { 'I', 'm', ' ', 'h', 'e', 'r', 'e', '\0' }); int kol; //str.Print(); MyText txt = new MyText(); txt.PlussString(str); // Добавление строки str txt.PlussString(str2); txt.PlussString(str3); txt.Print_t(); txt.DelString(1); // Удаление первой строки txt.Print_t(); txt.PlussString(str); kol = txt.KolStrok(); // Количество строк Console.WriteLine(kol); txt.Print_t(); txt.SmenaSimvola('r', 'F'); // Смена всех о на r в тексте txt.Print_t(); txt.PoiskStroki(2); // Поиск и вывод заданой строки txt.DelText(); // Очистка текста txt.Print_t(); }
public MySring[] DelString(int num) { num--; MySring[] _temptext = new MySring[c**t - 1]; for (int i = num; i < c**t - 1; i++) { _text[i] = _text[i + 1]; } for (int i = 0; i < c**t - 1; i++) { //if (num > c**t - 1) continue; _temptext[i] = _text[i]; } c**t--; return(_temptext); }
public MySring[] PlussString(MySring str) { MySring[] _temptext = new MySring[c**t]; for (int i = 0; i < c**t; i++) { _temptext[i] = _text[i]; } _text = new MySring[c**t + 1]; for (int i = 0; i < c**t; i++) { _text[i] = _temptext[i]; } _text[c**t] = str; c**t++; return(_text); }