Description

Analyze if a char is a control character. Returns true if the input char is a control character.

Syntax

Use the following function to evaluate a char variable:

isControl(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 a control character.

Example Code

char myChar = '\n'; // try with 'n' for a non control char

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

  if (isControl(myChar)) {  // tests if myChar is a control character
    Serial.println("The character is a control character");
  }
  else {
    Serial.println("The character is not a control character");
  }
}

void loop() {
}

See also