Corrected solution for StringtoInteger.