Golang int/float - string 的转换
如题,记录一下。
1. int – string
func TestStrconvInt(t *testing.T) {
// int
// int >> string
var a1 int
a1 = 11
s1 := strconv.Itoa(a1)
fmt.Printf("s1: %s\n", s1)
// string >> int
s2 := "22"
if a2, err := strconv.Atoi(s2); err == nil {
fmt.
原创
2021-03-24 14:26:11 ·
266 阅读 ·
0 评论