Description

Analyze if a char is printable with some content (space is printable but has no content). Returns true if the input char is printable.

Syntax

Use the following function to evaluate a char variable:

isGraph(thisChar)

Parameters

The function admits the following parameter:

thisChar: char variable to evaluate. Allowed data types: char.

Returns

The function returns true if the evaluated input variable is is printable.

Example Code

char myChar = ' '; // try with 'A' for a printable char

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

  if (isGraph(myChar)) {  // tests if myChar is a printable character but not a blank space.
    Serial.println("The character is printable");
  }
  else {
    Serial.println("The character is not printable");
  }
}

void loop() {
}

See also