Skip to content

isWhitespace / isSpace #7039

@171231

Description

@171231

in https://www.arduino.cc/reference/en/language/functions/characters/isspace/
isSpace() true by ASCII 9 and 32 (DEC).
in https://www.arduino.cc/reference/en/language/functions/characters/iswhitespace/
isWhitespace() true then ASCII-Code 9, 10, 11, 12, 13 and 32 (DEC)


void setup()
{
  Serial.begin(9600); // Serial Init
  while (!Serial); // Wartet auf seriellen Monitor
}

void loop() 
{
  for (int thisChar = 0; thisChar < 128; thisChar++)
  {
    Serial.print("Char: \'");
    Serial.write(thisChar);
    Serial.print("\'  ASCII: ");
    Serial.print(thisChar);
    Serial.print("  ");
    if (isSpace(thisChar))            { Serial.print(", isSpace()"); }
    if (isWhitespace(thisChar))       { Serial.print(", isWhitespace()"); }
    Serial.println(".");
  }
  while(1);
}

This Code maen: isSpace(thisChar); is true by 9, 10,11, 12 13 32 (DEC) and maen isWhitespace(thisChar) is true by 9 and 32 (DEC)

The great Problem is trim()!
What is wrong here?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions