cast icon indicating copy to clipboard operation
cast copied to clipboard

bug of toInt toInt32 toInt64

Open 84570829 opened this issue 4 years ago • 1 comments

a := []string{"01", "02", "03", "04", "05", "06", "07", "08", "09"} for _, v := range a { fmt.Println(cast.ToInt64(v)) } // output 1 2 3 4 5 6 7 0 0 // bug 08 => 0 09 =>0

84570829 avatar May 11 '20 03:05 84570829

This is not a bug --- since these leading 0s is treated as octal, or base-8 number system.

gonejack avatar Sep 20 '22 02:09 gonejack