Sub IntToHex($value As Integer, $digits As Integer) As String


Converts an integer value to a hexadecimal string.


The result contains at least $digits characters. If $digits is less than the required number of characters, the string is not truncated. If $digits is greater than the required number of characters, the result is padded with zeros.


Parameters


  • $value ... Integer value to convert.
  • $digits ... Integer. Number of digits in the result.


Example:

Dim $s

$s = IntToHex(46, 2)
' returns $s = 2E

$s = IntToHex(Asc("."), 2)
' returns $s = 2E