Hello,
For some reason, using
SearchText := 'Program Files';
ReplaceText := 'Program Files (x86)';
SearchAndReplace(SearchText, ReplaceText);
Would do absolutely nothing, it just won't change text, works fine when using any other text.
Is this some sort of "Reserve" word? Or ( ) is what makes it do not work?
procedure Tfc_Great.SearchAndReplace
(InSearch, InReplace: string) ;
var X, ToEnd : integer;
oldCursor : TCursor;
begin
oldCursor := Screen.Cursor;
Screen.Cursor := crHourglass;
with RichEdit1 do
begin
X := 0;
ToEnd := length(Text) ;
X := FindText(inSearch, X, ToEnd, []) ;
while X <> -1 do
begin
SetFocus;
SelStart := X;
SelLength := length(inSearch) ;
SelText := InReplace;
X := FindText(inSearch,
X + length(InReplace),
ToEnd, []) ;
end;
end;
Screen.Cursor := oldCursor;
end;