Главная страница | назад





Article #21550: Converting an integer into a binary string

Question:
How do I convert an integer into a binary string?

Answer:


function IntToBinStr(num: integer): string;
var
  i: integer;
begin
  for i := 0 to 31 do
    Result := IntToStr((num shr i) and 1)+Result;
end;

Last Modified: 05-APR-00