Logic to convert a string especification to unit