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

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

File
IdHexDigits: array [0..15] of AnsiChar = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');

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

IdHexDigits is used in the ByteToHex function to access the string representation for each nibble in the byte.

[Delphi] IdHexDigits, ByteToHex 

 

  function ByteToHex(const AByte : Byte) : shortstring;
  begin
    SetLength(Result, 2);
    Result[1] := IdHexDigits[AByte shr 4];
    Result[2] := IdHexDigits[AByte and $0F];
  end;
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.