go - Converting []uint8 to float64 -
what best way handle http resp.body
formatted []uint8
, not json? convert bytes float64
.
this returned value response:
value : %!f([]uint8=[48 46 48 48 49 50 53 53 50 49])
try using parsefloat
strconv
package (play):
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
Comments
Post a Comment