Amazon interview question

Write method that converts a string to a number