代码点读机 / Go / strconv.Itoa

strconv.Itoa Go · 包功能

把 int 转换成十进制整数字符串。

怎么用

s := strconv.Itoa(整数)

小例子

package main
import (
    "fmt"
    "strconv"
)

func main() {
    s := strconv.Itoa(123)
    fmt.Println(s)
}

运行结果

输出 123

提醒:I 是 Integer 的缩写,int 专用

官方文档:https://pkg.go.dev/strconv#Itoa

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条