1
2 //Example: a sentence must be broken up into words:
3
4 unit Unit1;
5
6 interface
7
8 uses
9 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
10 Dialogs, StdCtrls;
11
12 type
13 TForm1 = class(TForm)
14 Button1: TButton;
15 Memo1: TMemo;
16 procedure Button1Click(Sender: TObject);
17 private
18 { Private declarations }
19 public
20 { Public declarations }
21 end;
22
23 var
24 Form1: TForm1;
25
26 implementation
27
28 {$R *.dfm}
29
30 procedure BreakUp(const what, where: string; sl: TStrings);
31 begin
32 sl.Text:= StringReplace(what, where, #10, [rfReplaceAll,
33 rfIgnoreCase]);
34 end;
35
36 procedure TForm1.Button1Click(Sender: TObject);
37 begin
38 BreakUp('This is a sentence.', ' ', Memo1.Lines);
39 end;
40
41 end.
|