Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go
import "strconv"
i, err := strconv.ParseInt(s, 10, 0)

Radix 10. The third argument 0 means "fit in implementation-specific int". But the result type is always int64.
Don't ignore the potential error err !
import "strconv"
i, err  := strconv.Atoi(s) 

Atoi(s) is shorthand for ParseInt(s, 10, 0). It yields type int.
I : Integer := Integer'Value (s);

New implementation...