Routine to convert strings to integer