Convert `string` to `int` and vice-versa in Go
Posted on 31 May, 2020
There are basically 2-3 methods to convert integer to string and back to integer but the most easiest way is to use the Itoa
and Atoi
methods in the strconv
package.
Demo
Atoi
returns a second value (err
ignored in this example for easier understanding)
The above code should output:
See online demo
PreviousConcurrency Comparison: Go v/s ElixirNextCreating Python's next() alternative using Go Closures
Last updated