Remove characters from a text

-1

Hello, I need to make an application that inside a notepad (which I did) remove data in a range. What do I need now and how do I remove the email (in parentheses) from the phrase.
Example:

  

From: João de Almeida < [email protected]>
  To: João de Almeida

Does anyone know how to do or give a tip? Note: There are several names followed with email.

    
asked by anonymous 20.04.2015 / 19:36

2 answers

1

See if this is what you want to do !!

procedure TForm1.Button1Click(Sender: TObject);
 var p1, p2 : Integer; linha : String;
begin
   linha := 'De: João de Almeída <[email protected]>';
   ShowMessage('Antes: '+ linha );
   p1 := pos('<', linha );
   p2 := pos('>', linha );
   Delete( linha, p1, p2);
  ShowMessage('Depois: '+ linha );
end;
    
21.04.2015 / 00:05
-1

Follow the solution to the problem ...

procedure TfrmPrincipal.RemoverEmailJackson;
var
  vTexto: string;
  vTextoAux: TStringList;
  i: Integer;
begin
  try
    vTextoAux := TStringList.Create;
    vTexto := trim(Frmtexto.Memo1.Text);
    while length(vTexto) <> 0 do
    begin
      vTextoAux.Add(trim(Copy(vTexto, 0, pos('<', vTexto) - 1)));
      Delete(vTexto, 1, pos('>', vTexto) + 1);
    end;

    vTextoAux.Sort;
    Frmtexto.Memo1.Text := vTextoAux.Text;
  finally
    FreeAndNil(vTextoAux);
  end;
end;
    
28.04.2015 / 19:39