home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TOOL_INC.ZIP / ITOH.INC < prev    next >
Encoding:
Text File  |  1988-01-29  |  478 b   |  23 lines

  1.  
  2. (******************************************************
  3.  *
  4.  * Procedure:  itoh
  5.  *
  6.  * Purpose:    converts an integer into a string of hex digits
  7.  *
  8.  * Example:    s := itoh(i);
  9.  *
  10.  *)
  11.  
  12. function itoh(i: integer): anystring;   {integer to hex conversion}
  13.    function d(i: integer): char;
  14.    begin
  15.       i := i and 15;
  16.       if i > 9 then i := i + 7;
  17.       d := chr(i + ord('0'));
  18.    end;
  19. begin
  20.    itoh := d(i shr 12) + d(i shr 8) + d(i shr 4) + d(i);
  21. end;
  22.  
  23.