Fórum Substituir uma palava por outra em um Memo #208524
22/01/2004
0
Estou tentando fazer uma substituição em um memo:
Por exemplo:
procedure Replace(Antigo, Novo: string);
var
Idx, PosInicial: Integer;
begin
for Idx: = to Memo.Lines.Count do
begin
PosInicial := Pos(Antigo, Memo.Lines[Idx]);
if PosInicial > 0 then
begin
//Gostaria de fazer a substituicao aqui
end;
end;
end;
?????
Por exemplo:
procedure Replace(Antigo, Novo: string);
var
Idx, PosInicial: Integer;
begin
for Idx: = to Memo.Lines.Count do
begin
PosInicial := Pos(Antigo, Memo.Lines[Idx]);
if PosInicial > 0 then
begin
//Gostaria de fazer a substituicao aqui
end;
end;
end;
?????
Cbritojunior
Curtir tópico
+ 0
Responder
Posts
22/01/2004
Bico
Utilize o seguinte comando:
function Replace: string;
var
Texto: string;
begin
Texto := ´Realizando Teste de substituição de texto´;
result := StringReplace(Texto, ´Teste´, ´Substituído´, [rfReplaceAll]);
end;
function Replace: string;
var
Texto: string;
begin
Texto := ´Realizando Teste de substituição de texto´;
result := StringReplace(Texto, ´Teste´, ´Substituído´, [rfReplaceAll]);
end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)