Fórum reduzir código ! #165019
06/06/2003
0
Como reduzo esse if? Preciso fazer uma condição que o valor esteja entre 0 e 9
if (chr(bRead[i]) =´0´) or(chr(bRead[i]) =´1´) or (chr(bRead[i]) =´2´) or (chr(bRead[i]) =´3´) or (chr(bRead[i]) =´4´) or (chr(bRead[i]) =´5´) or (chr(bRead[i]) =´6´) or (chr(bRead[i]) =´7´) or (chr(bRead[i]) =´8´) or (chr(bRead[i]) =´9´) then
se possiver acrescentar de a a Z.
Valeu
if (chr(bRead[i]) =´0´) or(chr(bRead[i]) =´1´) or (chr(bRead[i]) =´2´) or (chr(bRead[i]) =´3´) or (chr(bRead[i]) =´4´) or (chr(bRead[i]) =´5´) or (chr(bRead[i]) =´6´) or (chr(bRead[i]) =´7´) or (chr(bRead[i]) =´8´) or (chr(bRead[i]) =´9´) then
se possiver acrescentar de a a Z.
Valeu
Fer
Curtir tópico
+ 0
Responder
Posts
06/06/2003
Luizbhering
Tente usar o in na condição. Use para número ou letras
if A in [0..9] then
begin
end;
if A in [´A´..´Z´] then
begin
end;
if A in [0..9] then
begin
end;
if A in [´A´..´Z´] then
begin
end;
Responder
Gostei + 0
06/06/2003
Fer
consegui assim
if chr(bRead[i]) in [´0´..´9´,´a´..´z´, ´A´..´Z´, ´ã´, ´&´] then
valeuuuuuu
if chr(bRead[i]) in [´0´..´9´,´a´..´z´, ´A´..´Z´, ´ã´, ´&´] then
valeuuuuuu
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)