I'm having some issues on trying to convert an int
to hex then, padding it with 0
s in order to get a 6 Characters String
which represents the hex number.
So far, I tried the following:
intNumber := 12
hexNumber := strconv.FormatInt(intNumber, 16) //not working
And then I found out how to pad it with 0
s, using %06d, number/string
. It makes all the strings 6 characters long.
Here you can Find a Playground which I set up to make some tests.
How can I achieve this in a efficient way?
For any Clarifications on the question, just leave a comment below. Thanks In advance.