Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#2

Re: Typ Word in binär umwandeln?!

  Alt 13. Okt 2003, 13:43
Delphi-Quellcode:
function IntToBin(Int: Integer): String;
var
i : Integer;
begin
Result := '';
for i := 7 downto 0 do
Result := Result + IntToStr((Int shr i) and 1);
end;

function BinToInt(Binary: String): Integer;
var
i : Integer;
begin
Result := 0;
for i := Length(Binary) downto 1 do
Inc(Result, StrToInt(Binary[i]) * 1 shl (Length(Binary) - i));
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat