I work with memo.
Three tasks memo1
step by step: first, the memo1
loaded into memo1
, then the lines from memo1
mixed, then you need to output them to the same memo
, replacing the text that was. The replacement of lines of the following type was also considered:
Text : string; begin Memo.Lines.Text := 'ΠΠ°ΠΌΠ΅Π½Π° ΡΠ΅ΠΊΡΡΠ° Π² Memo'; Text := StringReplace(Memo.Lines.Text, 'Memo', 'ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠ΅ Memo', [rfReplaceAll, rfIgnoreCase]); Memo.Lines.Text := Text;
But I have a dynamic array of strings in memo. I use three memo all works, but it is rather non-compact, I would like to do everything in one memo.
Tell me, please, how to do it.
here is a part of the code, the text file is loaded up to a certain line, the number of this line is set by the user in edit. With memo was so
var i,k:integer; sl: tstringlist; begin k:= StrToInt(Edit2.Text); sl:=tstringlist.create; sl.loadfromfile('Text.txt'); for i := 0 to k - 1 do Memo1.Lines.Add(sl[i]); sl.Free;
I try with tstringlist ..
var sl: tstringlist; // array for further work with it sl1: tstringlist; // array to load the file i, k: integer; begin kurs: = StrToInt (Edit1.Text);
if ((kurs=1) and (ComboBox1.ItemIndex=0)) then k:= StrToInt(Edit2.Text); sl1:=tstringlist.create; sl1.loadfromfile('MyFile.txt'); for i := 0 to k - 1 do sl.Add(sl1[i]);//ΡΠ°ΠΊ ΠΆΠ΅ sl.Add(sl1.Strings[used[i]]); ΡΠΎΠΆΠ΅ Π²ΠΎΠ·Π½ΠΈΠΊΠ°Π΅Ρ ΠΎΡΠΈΠ±ΠΊΠ°( sl.Free;