Recent

Author Topic: [SOLVED] Memo split text  (Read 293 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 514
[SOLVED] Memo split text
« on: September 03, 2023, 12:25:02 pm »
Hello, how can I improve the code so that it does not remove the period at the end of sentences?

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button5Click(Sender: TObject);
  2. var
  3.   SL: TStringList;
  4. begin
  5.   SL := TStringList.Create;
  6.   try
  7.     Split('.', Memo1.Lines.Text, SL);
  8.     Memo1.Lines.BeginUpdate;
  9.     Memo1.Lines.Text := SL.Text;
  10.     Memo1.Lines.EndUpdate;
  11.   finally
  12.     SL.Free;
  13.   end;
  14. end;
  15.  
  16. procedure TForm1.Split(const Delimiter: Char; Input: string; const Strings: TStrings);
  17. begin
  18.    Assert(Assigned(Strings));
  19.    Strings.Clear;
  20.    Strings.StrictDelimiter := True;
  21.    Strings.Delimiter := Delimiter;
  22.    Strings.DelimitedText := Input;
  23. end;
  24.  
« Last Edit: September 07, 2023, 08:08:08 pm by Pe3s »

Pe3s

  • Hero Member
  • *****
  • Posts: 514
Re: RichMemo
« Reply #1 on: September 03, 2023, 01:24:08 pm »
I did the margins  :)

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button4Click(Sender: TObject);
  2. Var
  3.   R: TRect;
  4. begin
  5.   SendMessage(Memo1.Handle, EM_GETRECT, 0, LPARAM(@R));
  6.   R.Left += 20;
  7.   R.Top += 20;
  8.   R.Right -= 20;
  9.   R.Bottom -= 20;
  10.   SendMessage(Memo1.handle, EM_SETRECT, 0, LPARAM(@R));
  11. end;
  12.  

 

TinyPortal © 2005-2018