Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int string2int(string thestring) {
- int result = 0;
- for(int i=0; i<thestring.length(); i++)
- if(thestring[i] >= '0' && thestring[i] <= '9')
- result = (result * 10) + (thestring[i] - '0');
- if(thestring[0] == '-')
- result = 0 - result;
- return result;
- }
Add Comment
Please, Sign In to add comment