get unit type, and convert string to numeric type