improve string to int function

removed the stupid if else workarond, direct integer conversion