static void Main(string[] args) { Text text = new Text(); var str1 = new Stroka("23423aaaadfkg"); text.AddString(str1); str1 = new Stroka("23423aaaadfkg"); text.AddString(str1); str1 = new Stroka("sdfghak"); text.AddString(str1); str1 = new Stroka("fdjgsdfkjfgnldfkg"); text.AddString(str1); str1 = new Stroka("fdjgsdfkjfgnldfkg"); text.AddString(str1); int n = 2; text.RemoveString(n); text.Output(); text.StrChange(3, "dkj"); text.SameString(); text.Output(); char find = 'a'; float freq = 0; text.TextFreq(find, ref freq); text.TextClean(); Console.WriteLine(freq); Console.ReadKey(); }
public void RemoveString(int n) { var data = new Stroka[size - 1]; for (int i = 0; i < n - 1; i++) { data[i] = Stroki[i]; } for (int i = n; i < size; i++) { data[i - 1] = Stroki[i]; } Array.Resize(ref Stroki, --size); Stroki = data; }
public void SameString() { bool issame = true; for (int i = 0; i < size - 1; i++) { for (int j = i + 1; j < size; j++) { issame = Stroka.IsSame(Stroki[i].getStrochka(), Stroki[j].getStrochka()); if (issame) { RemoveString(i + 1); i--; RemoveString(j); j -= 2; } } } }
public void StrChange(int n, string str) { Stroki[n - 1] = new Stroka(str); }
public void AddString(Stroka stroka) { Array.Resize(ref Stroki, ++size); Stroki[size - 1] = stroka; }