Hexadecimal conversions

Chris Pressey <>
Thu Nov 21 21:05:10 CET 2002


On Thu, 21 Nov 2002 10:18:26 +0100
Matthias Lang <> wrote:

> 
> Magnus Ahltorp writes:
>  > I have used my own to/from hex string converter several years now,
>  > but as I was trying to clean up my code, I wanted to get rid of it.
>  > 
>  > Is there a built-in hex string converter in Erlang? I've tried to
>  > look around, but I've never found one.
> 
> No BIF, as far as I know, but as of R9 there's
> httpd_util:hexlist_to_integer/1 and integer_to_hexlist/1

Indeed, as it says on the first page of the Inets Reference Manual, "Inets
is a container for Internet clients and servers... and miscellaneous data
conversion functions!" :)

Seriously, it's a bit ridiculous, don't you think?  How is a dependency on
httpd_util any cleaner than rolling your own string functions?  "Richer,
saner standard libraries" is definately at the top of my Erlang wish-list
this Christmas.

Also on the subject, there was once on this list some code to add hex
formatting to io_lib:format/2, but I don't know if it ever made it into
OTP...

-Chris



More information about the erlang-questions mailing list