Slide 11
Slide 11 text
ParseInt support underscores only in “base guessing” mode.
strconv.ParseInt("1_000", 0, 0) // 1000
strconv.ParseInt("0b1_000", 0, 0) // 8
strconv.ParseInt("0o1_000", 0, 0) // 512
strconv.ParseInt("0x1_000", 0, 0) // 4096
Otherwise, it will fail the same way it would fail with explicit base.
strconv.ParseInt("0b1_000", 2, 0) // invalid syntax
strconv.ParseInt("0b1000", 2, 0) // invalid syntax
strconv.ParseInt("1000", 2, 0) // 8
A note on strconv.ParseInt
11
Go 1.13