处理HTTP resp.Body
格式[]uint8
而不是JSON 的最佳方法是什么?我想将字节转换成float64
。
这是返回值响应:
value : %!F([]uint8=[48 46 48 48 49 50 53 53 50 49])
尝试ParseFloat
从strconv
包中使用(播放):
b := []uint8{48, 46, 48, 48, 49, 50, 53, 53, 50, 49}
f, err := strconv.ParseFloat(string(b), 64)
if err != nil {
// Handle parse error
}
fmt.Printf("%f\n", f) // 0.001255
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句