Home >Backend Development >Golang >How to convert string to Int type in golang
How to convert strings to various int types in golang:
Convert string to int:
int, err := strconv.Atoi(string)
Convert string to int64 :
int64, err := strconv.ParseInt(string, 10, 64)
int to string:
string := strconv.Itoa(int)
int64 to string:
string := strconv.FormatInt(int64,10)
For more golang knowledge, please pay attention to the golang tutorial column.
The above is the detailed content of How to convert string to Int type in golang. For more information, please follow other related articles on the PHP Chinese website!