String to Float64: multiple-value strconv.ParseFloat() in single-value context

后端 未结 1 1490
甜味超标
甜味超标 2021-01-21 13:14

I have an array of STRING slices like this:

[[header1 header2 startdate enddate header3 header4] 
[item1 100 01/01/2017 02/01/2017 5343340.56343 3.77252223956]          


        
1条回答
  •  情歌与酒
    2021-01-21 13:48

    The error you are getting is because the function ParseFloat returns two arguments and you are ignoring the second.

    j, err := strconv.ParseFloat(i[4], 64)
    if err != nil {
      // insert error handling here
    }
    (...)
    

    Try to always check the function's signature in godocs before using it.

    0 讨论(0)
提交回复
热议问题