[DUG] IntToBin
Marshland Engineering
marshland at marshland.co.nz
Mon Jun 21 22:05:19 NZST 2010
Hi Chaps
I found this on the web and it works but I don't understand how ?
Can anyone explain it ?
function IntToBin ( value:Integer; digits: integer ): string;
begin
result := StringOfChar ( '0', digits ) ;
while value > 0 do begin
if ( value and 1 ) = 1 then
result [ digits ] := '1';
dec ( digits ) ;
value := value shr 1;
end;
end;
Thanks Wallace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100621/74cc4e22/attachment.html
More information about the Delphi
mailing list