How does golang implement string conversion int

The method of converting string to int in go language: 1. Convert string to int by “int, err:=strconv.Atoi()” method; 2. Convert string to int by “int64, err:=strconv.ParseInt…” method Convert to int64.

Go language implements string conversion int

Convert string to int:

int, err := strconv.Atoi(string)

Convert string to int64:

int64, err := strconv.ParseInt(string, 10, 64)

Convert int to string:

string := strconv.Itoa(int)

Convert int64 to string:

string := strconv.FormatInt(int64,10)

Leave a Reply

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

en_USEnglish