How to convert a string value to an int in Go

If you need to convert a string to an int in Go, then you should use the strconv.Atoi function:

package main import ( "strconv" "fmt" ) func main() { t := strconv.Atoi("123") fmt.Println(t) }
Code language: Go (go)

Learn how to convert an int value to a string in Go.

Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments