Isdigit

From Pinguino
Jump to: navigation, search

Name

isDigit

Description

Determine if the byte x is a number,(in ASCII). These are the values in the range 48-57,(0-9).

Syntax

value = isDigit( x );
x
A char code(ASCII).
Output
1 if x is a digit, 0 in other case.

Example

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    if(Serial.available() > 0)
    {
        char c = Serial.read();
        Serial.printf("Is digit? %d\r\n",isDigit(c));
        Serial.printf("Is alpha? %d\r\n",isAlpha(c));
        Serial.printf("Is alphanum? %d\r\n",isAlphaNumeric(c));
        Serial.printf("Is cntrl? %d\r\n",isControl(c));
        Serial.printf("Is graph? %d\r\n",isGraph(c));
        Serial.printf("Is lower? %d\r\n",isLowerCase(c));
        Serial.printf("Is upper? %d\r\n",isUpperCase(c));
        Serial.printf("Is punct? %d\r\n",isPunct(c));
        Serial.printf("Is print? %d\r\n",isPrintable(c));
        Serial.printf("Is xdigit? %d\r\n",isHexadecimalDigit(c));
        Serial.printf("Is blank? %d\r\n",isWhitespace(c));
        Serial.printf("Is ascii? %d\r\n",isAscii(c));
        Serial.flush();
    }
}

Bugs

See also

isAlphaNumeric isAlpha

Comments