用pos函数做 for I:=0 to memo1.lines.count do begin posreturn:=pos(finddialog1.findtext,Memo1.lines[I]); if Posreturn<>0 then{找倒了} begin 。。 end
end;
要实现替换,用ReplaceDialog做代码差不多
StringReplace 用这个函数可以解决问题Returns a string with occurrences of one substring replaced by another substring.UnitSysutilsCategorystring handling routinestype TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;
for I:=0 to memo1.lines.count do
begin
posreturn:=pos(finddialog1.findtext,Memo1.lines[I]);
if Posreturn<>0 then{找倒了}
begin
。。
end
end;
用这个函数可以解决问题Returns a string with occurrences of one substring replaced by another substring.UnitSysutilsCategorystring handling routinestype
TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;