为什么此Golang代码无法将字符串转换为整数?

This should have been simple:

strconv.Atoi("1250000.0000")

This results in an error:

0 strconv.ParseInt: parsing "1250000.0000": invalid syntax

Any clues?

Atoi works only for strings that can be parsed as integers.

What you need is parseFloat

What dystroy said is true, but keep in mind that floats are inprecise and you could get an incorrect answer that way. In your case you can simply split the string on the period and then use Atoi on that.

strconv.Atoi(strings.Split("1250000.0000", ".")[0])