Re: how to enter binary number in Delphi



alanglloyd@xxxxxxx wrote:

On Oct 30, 3:08�pm, "cyrille de Brebisson" <cyri...@xxxxxx> wrote:

hello,

how can I write this code:
case a of
� $01000100: begin end;
� $01010100: begin end;
end;

etc where the nubmers are BINARY, not decimal, not hex, but binary, without
having to convert them myself (ie: the equivalent of the C 0b01001001)



AFAIK Delphi has no native binary type, nor any translation functions.
Are you sure you need a binary value. Or are you using something which
can be implemented as a set. Sets certainly produce clearer code.

Of course a BinStrToInt is a fairly simple function to code.

Alan Lloyd

But does the case statement require the cases to be constants?

Of course a constand can be defined that matched the binary pattern
and maybe have a meaningful name - - -

Jim P.
.