. , , ,

,,,

Tmemo — ,

. .

, TMemo (Editor), TFindDialog (FindDialog) TButton (Button).

:

procedure TForm1.ButtonClick(Sender: TObject);

begin

FindDialog.Execute; //

end;

True frHideWholeWord ( " "), frHideMatchCase ( " ") frDown (- ), False.

Editor HideSelection False.

.

:

var

SelPos,X,i:integer;

s,textE:string;

label 1;

, :

if frDown in FindDialog.Options

then Editor.SelStart:=Editor.SelStart+Editor.SelLength; // " "

textE:=Editor.Text;

X:=Editor.SelStart+1;

if frDown in FindDialog.Options

then

textE:=Copy(textE,X,Length(textE)-X+1)

else

textE:=Copy(textE,0,X-1);

s:=FindDialog.FindText; // s ,

:

if frDown in FindDialog.Options

then

{ }

begin

SelPos := Pos(s,textE);

if SelPos > 0

then

begin

Editor.SelStart := SelPos + X - 2;

Editor.SelLength:=length(s);

end

else ShowMessage(pchar(' "'+ FindDialog.FindText+'" .'));

end

else

{ }

begin

for i:=length(textE)-length(s) downto 1 do

if copy(textE,i,length(s))=s

then

begin

Editor.SelStart := i-1;

Editor.SelLength:=Length(s);

goto 1;

end;

ShowMessage(pchar(' "'+ FindDialog.FindText+'" .'));

1:

end;

, , , .

! . , .

http://andrey.nnov.ru/

. . , TMemo (Editor), TFindDialog (FindDialog) TButton (Button).

 

 

 

! , , , .
. , :