Hi Johan,
I think you are posting too late at night or one
is too many.
Also, I wasn’t careful enough with my writing. (I’ve not been at 100% for writing for the past few days.) Sorry about that!
When you give a “base” of 0 to ParseInt(), it is a special case. Then it can decode hex, octal, or decimal numbers, depending on the prefix: 0x for hex, 0 for octal, and none for decimal. (In other words, just like in C/C++/Go and other popular programming languages.
strconv.ParseInt("0x30", 0, 64) // "0x30" (hex) -> 48 (decimal)
strconv.ParseInt("0377",0,64) // "0377" (octal) -> 255 (decimal)
strconv.ParseInt("137",0,64) // "137" (decimal) -> 137 (decimal)
and to decode a string of 1s and 0s, you would have to recognize that the string represents a number in binary (base 2), then call
strconv.ParseInt("00100",2,64) // "100" (binary) -> 4 (decimal)