Conversion between strings and various int types in golang go

Go string and int conversion
1. Convert string to int:
int, err := strconv.Atoi(string)
2. Convert string to int64:
int64, err := strconv. ParseInt(string, 10, 64)
3. Convert int to string:
string := strconv.Itoa(int)
4. Convert int64 to string:
string := strconv.FormatInt(int64,10)

Leave a Reply

Your email address will not be published. Required fields are marked *