Fórum Acentuação #152842
08/04/2003
0
Alguém conhece uma rotina que elimine acentuação dentro de uma cadeia de caracteres, por exemplo cora[b:8847576fc0]çã[/b:8847576fc0]o para cora[b:8847576fc0]ca[/b:8847576fc0]o?
Grato pela atenção,
Marioguedes
Curtir tópico
+ 0Posts
08/04/2003
Anonymous
-------------------
function FiltraAcento(voldstr : string): string;
var x : integer;
vcaracter : string;
begin
Result := ´´;
for x := 1 to length(voldstr) do
begin
vcaracter := voldstr[x];
If voldstr[x] in [´Ã´,´Á´,´Ä´,´Â´,´À´] then
vcaracter := ´A´;
If voldstr[x] in [´ã´,´á´,´ä´,´â´,´à´] then
vcaracter := ´a´;
If voldstr[x] in [´É´,´Ê´,´Ë´,´È´] then
vcaracter := ´E´;
If voldstr[x] in [´é´,´ê´,´ë´,´è´] then
vcaracter := ´e´;
If voldstr[x] in [´Í´,´Î´,´Ï´,´Ì´] then
vcaracter := ´I´;
If voldstr[x] in [´í´,´î´,´ï´,´ì´] then
vcaracter := ´i´;
If voldstr[x] in [´Ó´,´Ô´,´Ö´,´Ò´,´Õ´] then
vcaracter := ´O´ ;
If voldstr[x] in [´ó´,´ô´,´ö´,´ò´,´õ´] then
vcaracter := ´o´ ;
If voldstr[x] in [´Ú´,´Û´,´Ü´,´Ù´] then
vcaracter := ´U´;
If voldstr[x] in [´ú´,´û´,´ü´,´ù´] then
vcaracter := ´u´;
If voldstr[x] = ´º´ then
vcaracter := ´o.´ ;
If voldstr[x] = ´ª´ then
vcaracter := ´a.´;
If voldstr[x] = ´Ç´ then
vcaracter := ´C´;
If voldstr[x] = ´ç´ then
vcaracter := ´c´;
Result := Result + vcaracter ;
end;
end;
execute
--------
coloque por exemplo no evento on exit do edit1.
procedure Tedit1.exit....
begin
Edit1 := FiltraAcento(Edit1.Text);
end;
Gostei + 0
08/04/2003
Marioguedes
Gostei + 0
30/04/2003
Wgm8
Inseri a function acima, e a procedure do OnExit, mas quando vou compilar ele dá a menssagem:
[Error] Acento.pas(63): Incompatible types: ´TEdit´ and ´String´
O que está errado?
Gostei + 0
05/05/2003
Wgm8
Gostei + 0
05/05/2003
Marcelo.c
No código:
procedure Tedit1.exit....
begin
Edit1 := FiltraAcento(Edit1.Text);
end;
onde está apenas [b:6e4c893cce]Edit1[/b:6e4c893cce] deve-se colocar [b:6e4c893cce]Edit1.Text[/b:6e4c893cce]
Gostei + 0
05/05/2003
Wgm8
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)