I have the lines in memo like:
111111.kll
222222.kll
I need to remove last 4 char from each line to obtain result like:
111111
222222
As an alternative to GolezTrol's solution, you can manipulate the Memo content directly, instead of making a copy of it in memory first:
var
i, LineStart, LineLen: Integer;
begin
Memo1.Lines.BeginUpdate;
try
for i := 0 to Memo1.Lines.Count - 1 do
begin
LineStart := Memo1.Perform(EM_LINEINDEX, i, 0);
LineLen := Memo1.Perform(EM_LINELENGTH, LineStart, 0);
Memo1.Perform(EM_SETSEL, LineStart + LineLen - 4, LineStart + LineLen);
Memo1.SelText := '';
end;
finally
Memo1.Lines.EndUpdate;
end;
end;