摘要: golang学习笔记14 golang substring 截取字符串 golang 没有java那样的substring函数,但支持直接根据 index 截取字符串 mystr := "hello world" fmt.Print(mystr[0:5]) 阅读全文
posted @ 2018-06-05 22:03 大自然的流风 阅读(8644) 评论(0) 推荐(0) 编辑
摘要: golang学习笔记13 Golang 类型转换整理 go语言string、int、int64、float64、complex 互相转换 #string到int int,err:=strconv.Atoi(string) #string到int64 int64, err := strconv.ParseInt(string, 10, 64) #int到string string:=strconv.Itoa(int) #int64到string string:=strconv.FormatInt(int64,10) #int到int64,把int先转成字符串再转成int64,返回带err参数的需要忽略掉 s := strconv.Itoa(int) s64,_ := strconv.ParseInt(s,10,64) 复数,求平方,10的5次方 cmplx.Pow(10,5) 阅读全文
posted @ 2018-06-05 21:59 大自然的流风 阅读(29935) 评论(0) 推荐(0) 编辑