KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Converting Integer values to Hexadecimal values using 4D Code
PRODUCT: 4D | VERSION: 11.6 | PLATFORM: Mac & Win
Published On: May 20, 2011

Here is a quick method that can be used for converting Integer values to Hexadecimal values using 4D code:

If (Count parameters=1)
C_LONGINT($1)
C_TEXT($0)
$0:=Replace string(String($1;"&$");"$";"")
End if


If the above code is saved as a project method named UTIL_IntToHex it could be used to convert an integer value to a hexadecimal value like so:

C_TEXT($hex)
$hex:=UTIL_IntToHex(77)


In the above example $hex would be equal to "4D".