spf13 / cast

safe and easy casting from one type to another in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cast.ToInt("08") returned 0

zangsilu opened this issue · comments

invalid syntax, returned 0 But the correct one is to return 8
castError

The string "08" is not a decimal number, decimal numbers do not have the prefix "0", nor is it an octal number, octal numbers are only 0-7, nor is it a hexadecimal number, the hexadecimal prefix is "0x ". I don't think this is a problem with the library, I think it's important to be aware of this limitation before using the library and avoid it in advance.