Microsoft interview question

Design a function that converts a string to an integer.