if(s[i] != '.') //After finding all digits, if the next character return 0; //is not a period, exit, else, move to next. else i++;