GARANTIR DESCONTO

Fórum Preciso de uma simples função #211799

05/02/2004

0

Como faço para Receber uma string e tirar todos os acentos dela...

Valeu!!

[]´s Ricardo
ricardo@dgpram.com.br


Shikota

Shikota

Responder

Posts

05/02/2004

Lucas Silva

Esse assunto já rolou aqui no fórum.
Tenta pesquisar sobre ele ai....


Responder

Gostei + 0

05/02/2004

Imoreira

Function TiraAcento(Str: String): String;
function strtran(Str: String; Antigo: String; Novo: variant): string;
var
Buffer : string;
x      : integer;
begin
     Buffer := ´´;
     for x := 1 to length(Str) do begin
         if copy(Str,x,1) = Antigo then begin
            Buffer := Buffer + Novo;
         end else begin
            Buffer := Buffer + copy(Str,x,1);
         end;
     end;
     Result := Buffer;
end;


begin
     Str := Strtran(Str,´Ã´,´A´);
     Str := Strtran(Str,´Õ´,´O´);
     Str := Strtran(Str,´Á´,´A´);
     Str := Strtran(Str,´É´,´E´);
     Str := Strtran(Str,´Í´,´I´);
     Str := Strtran(Str,´Ó´,´O´);
     Str := Strtran(Str,´Ú´,´U´);
     Str := Strtran(Str,´À´,´A´);
     Str := Strtran(Str,´È´,´E´);
     Str := Strtran(Str,´Ì´,´I´);
     Str := Strtran(Str,´Ò´,´O´);
     Str := Strtran(Str,´Ù´,´U´);
     Str := Strtran(Str,´Ê´,´E´);
     Str := Strtran(Str,´Ô´,´O´);
     Str := Strtran(Str,´Ç´,´C´);
     Result := Str;
end;

Use-a assim:
label1.caption:=TiraAcento(edit1.text);


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar