Implementation of changing a string to a long without using a built-in function.