route:= this.GetString("route") hight:= this.GetString("hight") bridge:= this.GetString("bridge") oil:= this.GetString("oil") // total:= this.GetString("Total") // var total=hight+bridge+oil // var total=strconv.Atoi(hight)+strconv.Atoi(bridge)+strconv.Atoi(oil) var total, err = strconv.ParseFloat(hight, '10', -1, 32)+strconv.ParseFloat(bridge, '10', -1, 32)
▶ 0003 Failed to build the application: # opms/controllers/financial controllers\financial\financial.go:160:6: err redeclared in this block previous declaration at controllers\financial\financial.go:140:5 controllers\financial\financial.go:160:37: too many arguments in call to strconv.ParseFloat have (string, number, number, number) want (string, int) controllers\financial\financial.go:160:37: multiple-value strconv.ParseFloat() in single-value context controllers\financial\financial.go:160:45: invalid character literal (more than one character) controllers\financial\financial.go:160:77: too many arguments in call to strconv.ParseFloat have (string, number, number, number) want (string, int) controllers\financial\financial.go:160:77: multiple-value strconv.ParseFloat() in single-value context
求教各位大神,如何把字符串的转成float的小数相加后再转换回字符串,谢谢
有疑问加站长微信联系(非本文作者)

example
具体用法参考文档:https://golang.org/pkg/strconv/#pkg-index
谢谢