Thema: Delphi Bits in Bytes unwandeln

Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#4

Re: Bits in Bytes unwandeln

  Alt 21. Jul 2007, 12:29
Hallo,

hier noch eine Alternative:

Delphi-Quellcode:
function DualStrToCard(const s: string): Cardinal;
var
  i: Integer;
begin
  Result := 0;
  for i := 1 to Length(s) do
    Result := Result shl 1 + Ord(s[i] = '1');
end;
Grüße vom marabu
  Mit Zitat antworten Zitat