Go语言string,int,int64 ,float之间类型转
//string到int
int,err:=strconv.Atoi(string)
//int到string
string:=strconv.Itoa(int)
//string到int64
int64, err := strconv.ParseInt(string, 10, 64)
//int64到string
string:=strconv.FormatInt(int64,10)
//string到float32(float64)
float,err := strconv.ParseFloat(string,32/64)
//float到string
string := strconv.FormatFloat(float32, 'E', -1, 32)
string := strconv.FormatFloat(float64, 'E', -1, 64)
本文标题:Go语言string,int,int64 ,float之间类型转
本文链接:https://www.haomeiwen.com/subject/vgpiyftx.html
网友评论