isSpace()

Description

Check if a character is a white-space character or not. Returns true if the character is a space, form feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), or vertical tab ('\v').

Syntax

isSpace(thisChar)

Parameter Values

  • thisChar: variable. Allowed data types: char.

Return Values

  • true: If thisChar is a white-space character.
  • false: Otherwise

Example Code

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

See Also

Please note: These are affiliate links. If you buy the components through these links, We may get a commission at no extra cost to you. We appreciate it.