This page is also available in 3 other languages

isWhitespace()

[Characters]

Description

Analyse if a char is a white space, that is space, formfeed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v')). Returns true if thisChar contains a white space.

Syntax

isWhitespace(thisChar)

Parameters

thisChar: variable. Allowed data types: char

Returns

true: if thisChar is a white space.

Example Code

if (isWhitespace(myChar)) { // tests if myChar is a white space
  Serial.println("The character is a white space");
}
else {
  Serial.println("The character is not a white space");
}

See also