有没有函数可以直接实现10进制2进制转换的啊?

解决方案 »

  1.   

    Delphi自己没有提供10进制到2进制的转换,但是可以自己写,自己写也很容易
      

  2.   

    先轉成16進制, 用HexToBin!Converts a string of hexadecimal digits to the corresponding binary value.UnitClassesCategorytype conversion routinesDelphi syntax:function HexToBin(Text, Buffer: PChar; BufSize: Integer): Integer
    DescriptionCall HexToBin to convert the hexadecimal string Text to the binary value it represents.Text is a string representation of a hexadecimal value.Buffer returns the resulting value in binary.BufSize is the size of Buffer. Text needs to point to at least 2*BufSize hexadecimal characters, because each two hexadecimal characters represent one byte.HexToBin returns the number of characters in Buffer that have not been used because Text did not contain valid hexadecimal characters ('0'..'f').