Mega Code Archive

 
Categories / Delphi / Algorithm Math
 

Convert an integer to an octal number

...convert an Integer to an octal number? Autor: Katja Hoffmann Homepage: http://www.katjahoffmann.gmxhome.de [Write new comment] [ Print tip ] Tip Rating (4): function IntToOct(Value: Longint; digits: Integer): string; var rest: Longint; oct: string; i: Integer; begin oct := ''; while Value <> 0 do begin rest := Value mod 8; Value := Value div 8; oct := IntToStr(rest) + oct; end; for i := Length(oct) + 1 to digits do oct := '0' + oct; Result := oct; end;