golang strconv Atoi Itoa 例子

package main
     
import (
    "strconv"
)
     
func main() {
    i, err := strconv.Atoi("12345")
    if err != nil {
        panic(err)
    }
    i += 3
    println(i)
     
    s := strconv.Itoa(12345)
    s += "3"
    println(s)
}

string()好像是可以把[]byteASCII转为字符串,strconv.Itoa好像就是把数字转为字符串; 如果遇到一个ASCII的数字,使用strconv.Itoa是不能进行转换成字母或字符串的;


posted @ 2019-01-08 14:10  small_lei_it  阅读(1210)  评论(0)    收藏  举报