Ver Mensaje Individual
  #2  
Antiguo 27-11-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Prueba a ver si te sirve esta rutina:

Código Delphi [-]
procedure ReplaceText(RichEdit: TRichEdit; const Text, ReplaceText: String);
var
  TextStart: Integer;
  TextLength: Integer;

begin
  TextStart := RichEdit.FindText(Text, 0, Length(RichEdit.Text), [stWholeWord]);
  TextLength := Length(Text);

  while TextStart <> -1 do
  begin
    RichEdit.SelStart := TextStart;
    RichEdit.SelLength := TextLength;
    RichEdit.SelText := ReplaceText;

    TextStart := RichEdit.FindText(Text, 0, Length(RichEdit.Text), [stWholeWord]);
  end;
end;

Ejemplo de uso:

Código Delphi [-]
ReplaceText(RichEdit1, 'nombre', n);

// Saludos
Responder Con Cita