类型
Atoi
package main
import (
"fmt"
"strconv"
)
func main() {
// string <-> int
s := "996"
si, err := strconv.Atoi(s)
if err != nil {
fmt.Println("cha't change to the type")
} else {
fmt.Printf("type: %T:of value:%#v", si, si)
}
}
iota
package main
import (
"fmt"
"strconv"
)
// Itoa
func main() {
i2 := 996
fmt.Printf("type: %T value: %v", i2, i2)
s2 := strconv.Itoa(i2)
fmt.Printf("type: %T value: %v", s2, s2)
}