base: Fix string to int conversion
Created by: valschneider
Because it relied on str.isdigit(), Base.string_cast() would erroneously assume a hex string (e.g. "0x42") wouldn't be castable to int.
Use a more robust pattern using try/except blocks. This will happily cope with negative and hex values.
While at it, rename string_cast() to string_cast_int(), since the former only handles ints and does an ugly empty return when the specified type isn't int.