Golang strconv package is designed for string conversation process.
strconv.Atoi(str)
Example: nmb,err:=strconv.Atoi("12345") if err!=nil{ panic(err) }
String to Int
strconv.Atoi(str) method converts string to integar base on 10. it's same thing as strconv.ParseInt(str,10,0)
strconv.ParseInt(str,base,bitSize) additionally can parse on base 2,8,16.
Int parse modes
If the base argument is 0, the true base is implied by the string's.
Prefix following the sign (if present): 2 for "0b", 8 for "0" or "0o".
16 for "0x", and 10 otherwise. Also, for argument base 0 only,
n, err := strconv.ParseInt("0Xf1af", 0, 64)fmt.Println(n, err)result :: 61871 <nil>