Extract method to convert string to degree.