Golang convertit la chaîne en int
Int, err := strconv.Atoi("12345")
Splendid-est Swan
Int, err := strconv.Atoi("12345")
str := strconv.Itoa(12)
s := "97"
n, err := strconv.ParseInt(s, 10, 64)
if err == nil {
fmt.Printf("%d of type %T", n, n)
}
b, err := strconv.ParseBool("true")
f, err := strconv.ParseFloat("3.1415", 64)
i, err := strconv.ParseInt("-42", 10, 64)
u, err := strconv.ParseUint("42", 10, 64)
var i int = 32
j := int64(i)
s := "97"
n, err := strconv.ParseInt(s, 10, 64)
if err == nil {
fmt.Printf("%d of type %T", n, n)
}
// Output: 97 of type int64