I have a package of hexadecimal values โโthat I'm trying to handle. They enter a line. For example, one part of the C0 packet, which is equal to 192 . However, I'm not quite sure how to convert the string value to an integer value.
If I use this:
Base.decode16!("C0")
... I get a binary file.
The only way I can think to extract this integer value is like this:
<<x>> = Base.decode16!("C0") x
It works, and it looks like an idiom, but I'm new to Elixir and don't know how much the best solution is. How could you translate the hex value of a string to an integer in Elixir?
source share