More robust string -> int or float conversion.