Itoa():整型转字符串
Atoi():字符串转整型
package main
import (
"fmt"
"strconv"
)
func main() {
num:=100
str:=strconv.Itoa(num)
fmt.Printf("%T %#v",str,str)
}
//string "100"
func main() {
num:="100"
str,_:= strconv.Atoi(num)
fmt.Printf("%T %#v",str,str)
}
//int 100
网友评论