delphi DecToBinStr


本文整理自网络,侵删。

 
function DecToBinStr(N: Integer): string;
var
  S: string;
  i: Integer;
  Negative: Boolean;
begin
  Negative := False;
  if N < 0 then Negative := True;
  N := Abs(N);
  for i := 1 to SizeOf(N) * 8 do
  begin
    if N < 0 then S := S + '1'
    else S := S + '0';
    N := N shl 1;
  end;
  Delete(S, 1, Pos('1', S) - 1);
  if Negative then S := '-' + S;
  Result := S;
end;

相关阅读 >>

Delphi 比较图片是否相同

Delphi 官方使用并行编程库介绍

Delphi中的record怎么动态分配内存?

Delphi报警声音 beep、messagebeep 和 windows.beep

Delphi form工程创建

Delphi intraweb 在iis下发布的web.config

Delphi 关于虚拟的desktop的编程

Delphi中组件label、edit、tag、memo、richedit

Delphi string.split 按照任意字符串分割语句

Delphi 字符串与二进制数之间的互相转换

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...