cast icon indicating copy to clipboard operation
cast copied to clipboard

the function ToInt sometimes has some mistakes

Open answergong opened this issue 3 years ago • 2 comments

eg: a := "0100" b := cast.ToInt(a) fmt.Println(b)

the result is 64 but what i want is 100

answergong avatar Jan 19 '22 07:01 answergong

0100 is a number in base 8, therefore it means 64, not 100.

yveshield avatar Jan 19 '22 08:01 yveshield

0100 is a number in base 8, therefore it means 64, not 100. thanks for your reply! in my code:
a :="0100" the type of a is string ,so i still think this is a mistake

answergong avatar Jan 19 '22 08:01 answergong