Código
function TiraCaracterEspecial(texto : String) : String;
begin
if (texto <> '') then Texto := StringReplace(Texto, 'ç', 'c', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'à', 'a', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'á', 'a', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'ó', 'o', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'ã', 'a', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'ê', 'e', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'ô', 'o', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '§', ' ', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '$', ' ', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '@', ' ', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '£', ' ', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, 'ü', 'u', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '#', ' ', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '1ª', '1', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, '1º', '1', [rfreplaceall]);
if (texto <> '') then Texto := StringReplace(Texto, ' ', ' ', [rfreplaceall]);
Result := Texto;
end;
// Como usar...
procedure TForm1.edit1Exit(Sender: TObject);
begin
edit1.Text := TiraCaracterEspecial(edit1.Text);
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009