[Go - Basic] 基本变量类型转换
文章目录
数字转字符串
import "strconv"
- int -> string
strconv.Itoa(i int) string
- int64 -> string
strconv.FormatInt(i int64, base int) string
base = 10
字符串转数字
import "strconv"
- string -> int
strconv.Atoi(s string) (int, error)
- string -> int64
strconv.ParseInt(s string, base int, bitSize int) (i int64, err error)
base = 10
bitSize = 64
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论