请问哪位知道把字符串转换成二进制的函数????急等啊

解决方案 »

  1.   

    function ByteToBinStr(const B: Byte): string;
    const
      CA: array [0..7] of Byte = (1, 2, 4, 8, 16, 32, 64, 128);
    var
      I: Integer;
    begin
      Result := '';
      for I := 0 to SizeOf(CA)-1 do
      begin
        if (B and CA[I]) <> 0 then
          Result := '1' + Result
        else
          Result := '0' + Result;
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit2.Text := ByteToBinStr(Ord('A'));
    end;