1

I have to convert a utf8 character to its corresponding hex value in Elixir-Lang.

For example, if I pass "A" into the function, 41 is returned (which is the hex value for "A").

Any Suggestions?

Kshitij Mittal
  • 2,515
  • 3
  • 22
  • 37

1 Answers1

2

You are probably looking for Base.encode16/1:

iex> Base.encode16 "A"
"41"
Patrick Oscity
  • 51,870
  • 16
  • 134
  • 161