Filipe Santos
Filipe Santos

Reputation: 1671

Converting decimal to hex with Erlang?

How to convert the decimal "37" to the hex Value "25" in Erlang? Is there a simple way?

Upvotes: 14

Views: 7542

Answers (2)

Kijewski
Kijewski

Reputation: 26022

integer_to_list(Integer, Base) -> string() transforms an integer to a list of any base you supply: http://erldocs.com/18.3/erts/erlang.html?i=3&search=integer_to#integer_to_list/2

Upvotes: 27

Dmitriy
Dmitriy

Reputation: 1442

A little simpler solution: httpd_util:integer_to_hexlist(Number) -> HexString

Upvotes: 2

Related Questions