reduzir código !

Delphi

06/06/2003

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


Fer

Fer

Curtidas 0

Respostas

Luizbhering

Luizbhering

06/06/2003

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;


GOSTEI 0
Fer

Fer

06/06/2003

consegui assim

if chr(bRead[i]) in [´0´..´9´,´a´..´z´, ´A´..´Z´, ´ã´, ´&´] then

valeuuuuuu


GOSTEI 0
POSTAR