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之间类型转换方法)