| imho.ws |
![]() |
|
|
|||||||
|
Сообщения:
Перейти к новому /
Последнее
|
Опции темы |
|
|
# 1 |
|
Newbie
Регистрация: 09.08.2002
Адрес: prison
Сообщения: 10
![]() |
Реализация очень простая. Загружаю в memo или richedit текстовый файл,
и по зараннее заготовленной базе или текстового файла с словами, проверяю если слово в базе есть, то заменить в моем загруженном файле. Вот и все никаких наворото ничего только основу расскажите
__________________
Satanas |
|
|
|
|
# 5 |
|
Junior Member
Регистрация: 12.09.2002
Сообщения: 99
![]() |
хэлпы рулят
![]() Код:
procedure TForm1.Button1Click(Sender: TObject);
begin
FindDialog1.Position := Point(RichEdit1.Left + RichEdit1.Width, RichEdit1.Top);
FindDialog1.Execute;
end;
procedure TForm1.FindDialog1Find(Sender: TObject);
var
FoundAt: LongInt;
StartPos, ToEnd: Integer;
begin
with RichEdit1 do
begin
{ begin the search after the current selection if there is one }
{ otherwise, begin at the start of the text }
if SelLength <> 0 then
StartPos := SelStart + SelLength;
else
StartPos := 0;
{ ToEnd is the length from StartPos to the end of the text in the rich edit control }
ToEnd := Length(Text) - StartPos;
FoundAt := FindText(FindDialog1.FindText, StartPos, ToEnd, [stMatchCase]);
if FoundAt <> -1 then
begin
SetFocus;
SelStart := FoundAt;
SelLength := Length(FindDialog1.FindText);
end;
end;
end;
__________________
Latest Active Project: nC++ |
|
|
|
|
# 7 |
|
Junior Member
Регистрация: 12.09.2002
Сообщения: 99
![]() |
var
strfrom,strto:string str:string; i:integer; -------------- for i:=0 to memo1.lines.count-1 do begin str:=memo1.lines[i]; if pos(strfrom,str)>0 then memo1.lines[i]:= copy(str,0,pos(strfrom,str)-1)+strto+copy(str,pos(strfrom,str)+length(strfrom)),length(str)-(pos(strfrom,str)+length(strfrom))); end; вот,писал прямо тут,значит мог в количестве скобок ошибиться =\ но в целом должно работать ![]() strfro - что ищем strto - на что заменяем.... я думаю в цикле сможешь запускать,и подставлять from/to
__________________
Latest Active Project: nC++ |
|
|