Fix the check for a digit by checking if the value is between the character '0' (not value 0) and '9'.