How to say != 0-9 in c ++

c++, java, syntax

Solution

C++:

#include <cctype>
using namespace std;
...
if (!isdigit(str[i]))

// or

if (str[i] < '0' || str[i] > '9')

Java:

if (!Character.isDigit(str.charAt(i)))

Problem

Possible Duplicate: how to check if given c++ string or char* contains only digits? Im trying to say that ``` if(string.at(i) != 0-9){ b= true; } ``` Is there a way to say this without typing value != 0 && value != 1 ...etc? Also if this exists and is possible, and its different in java I also would find that helpful. Thanks you guys are always helpful.

Original source

Related problems