cast icon indicating copy to clipboard operation
cast copied to clipboard

cast.ToInt("08") return 0 and so on

Open kay011 opened this issue 11 months ago • 2 comments

`package main

import ( "fmt" "strconv"

"github.com/spf13/cast"

)

func main() {

for i := 0; i <= 20; i++{
	fmt.Println(cast.ToInt(fmt.Sprintf("0%d",i)))
}
fmt.Println("-------------------")
for i := 0; i <= 20; i++{
	nums, _ := strconv.Atoi(fmt.Sprintf("0%d",i))
	fmt.Println(nums)
}

}`

result: 0 1 2 3 4 5 6 7 0 0 8 9 10 11 12 13 14 15 0 0 16

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

kay011 avatar Mar 14 '24 13:03 kay011

same reason as #216

bagualing avatar Jun 28 '24 01:06 bagualing

same problem

jeristiano avatar Jul 08 '24 07:07 jeristiano