Topic Path: Symbol Reference > Constants > IdOctalDigits Constant
ContentsIndexHome
PreviousUpNext
IdOctalDigits Constant

Identifies characters used in the octal representation of a numeric value.

File
IdOctalDigits: array [0..7] of AnsiChar = ('0','1','2','3','4','5','6','7');

IdOctalDigits is a constant array containing valid characters that can be used in the octal representation of a numeric value. IdOctalDigits characters can be accessed by an index value that corresponds to the decimal value for the octal character. 

IdOctalDigits is used in the ByteToOctal function to access the string representation for each triplet in the byte value.

[Delphi] IdOctalDigits, ByteToOctal 

 

  function ByteToOctal(const AByte : Byte) : String;
  begin
    SetLength(Result,3);

    Result[1] := IdOctalDigits[(AByte shr 6) and $07];
    Result[2] := IdOctalDigits[(AByte shr 3) and $07];
    Result[3] := IdOctalDigits[AByte AND $07];

    if Result[1] <> '0' then
    beginResult := '0' + Result;
    end;
  end;
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.