string To int
-
字符串为纯数字,值为:123456
aInt, _ := strconv.Atoi("123456") fmt.Printf("数据类型: %T, 值: %d", aInt, aInt)
-
字符串不为纯数字,值为:0
aInt, _ := strconv.Atoi("123456d") fmt.Printf("数据类型: %T, 值: %d", aInt, aInt)
int To String
-
int 转到字符串
aInt := strconv.Itoa(1234) fmt.Printf("数据类型: %T, 值: %v", aInt, aInt)
-
int64 转字符串 int64 取值范畴:-9223372036854775808 – 9223372036854775807
aInt := strconv.Itoa(1234) fmt.Printf("数据类型: %T, 值: %v", aInt, aInt)