I need to convert an uint32
to string
. How can I do that? strconv.Itoa
doesn’t seem to work.
I would do this using strconv.FormatUint
:
import "strconv"
var u uint32 = 17
var s = strconv.FormatUint(uint64(u), 10)
// "17"
Note that the expected parameter is uint64
, so you have to cast your uint32
first. There is no specific FormatUint32
function.