unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ActnList, ComCtrls;
type
TMainForm =
class(TForm)
RichEdit: TRichEdit;
ActionButton: TButton;
procedure ActionButtonClick(Sender: TObject);
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
function ParseStr(
var S:
String; delimit:
string; purge: boolean):
string;
var
i: integer;
begin
for i := 1
to Succ(Length(S))
do
if (i > Length(S))
or (Pos(S[i], Delimit) > 0)
then Break;
Result := Copy(S, 1, Pred(i));
Dec(i, Ord(
not purge));
Delete(S, 1, i);
end;
procedure MakeWordList(s, delimiters:
string; sl: TStrings);
var
t:
string;
begin
sl.Clear;
while s <> '
'
do begin
t := ParseStr(s, delimiters, true);
if t <> '
'
then
sl.Add(t);
end;
end;
procedure TMainForm.ActionButtonClick(Sender: TObject);
begin
MakeWordList(RichEdit.Text, #9#13#10#32'
?!".,;:=()/&%$<>#''
', RichEdit.Lines);
end;
end.