Go: Convert int64 to string

To decimal string:

n := int64(32)
str := strconv.FormatInt(n, 10)
fmt.Println(str)  // Prints "32"

To hexadecimal string:

n := int64(32)
str := strconv.FormatInt(n, 16)
fmt.Println(str)  // Prints "20"

Comments

Be the first to comment!