I'm new at go and I've been trying to cast the string "0x0000" into a hexadecimal with no luck so far. Here's what I tried:
import "strconv"
c, err := strconv.ParseUint("0x0000", 16, 32)
if err != nil {
return err, nil
}
which throws the error: strconv.ParseUint: parsing "0x0000": invalid syntax
.
I've also tried uint16("0x0000")
but apparently I also can't convert a string directly to uint16
. I'm sure it's very trivial, so any help would be appreciated. Thanks.