Atoi in Go

Posted by GoDoc
Public (Editable by Users)

Atoi is equivalent to ParseInt(s, 10, 0), converted to type int.

Go
Edit
package main

import (
	"fmt"
	"strconv"
)

func main() {
	v := "10"
	if s, err := strconv.Atoi(v); err == nil {
		fmt.Printf("%T, %v", s, s)
	}
}