Golang int64 to String Conversion: Simple Guide
In Go, you can convert an int64 to a string using the strconv package. Here's a simple example:
import (
"fmt"
"strconv"
)
func main() {
num := int64(1234567890)
str := strconv.FormatInt(num, 10)
fmt.Println(str)
}
Output:
1234567890
In the code above, we use the strconv.FormatInt() function to convert the int64 number to a string in base 10 (decimal). The first argument is the number to be converted, and the second argument is the base to be used for conversion. In this case, we chose base 10 (10).
原文地址: https://www.cveoy.top/t/topic/f3LN 著作权归作者所有。请勿转载和采集!