IntToBin(2-16进制转换函数)
今天图老师小编给大家精心推荐个IntToBin(2-16进制转换函数)教程,一起来看看过程究竟如何进行吧!喜欢还请点个赞哦~
function IntToBin(Value: Integer; Count: Integer=32): string;
var
iTemp: Integer;
begin
Result := '';
while Count0 do
begin
iTemp := Value shr (Count-1) and 1;
case iTemp of
1: Result := Result+'1';
0: Result := Result+'0';
end;
Dec(Count);
end;
end;
自己写的,不知有否漏洞,测试了一下
ShowMessage(IntToBin(-1,8)); //输出11111111
ShowMessage(IntToBin(333333)); //输出00000000000001010001011000010101