Skip to content

[BUG] isWhitespace() / isSpace() #7041

@171231

Description

@171231

Good Morning facchinm
Issue #7039 not a BUG?
Fail!

the isWhitespace() function bring Char \9 (TAB) and \32 (SPACE) as true
the isSpace() bring \9 \10 \11 \12 \13 \32 as true

the ctype.h have isBlank() function,
Implementation?
Highligth isBlank() NONE / but isBlank() gives \9 and \32 as true

Also repair:
Arduino isWhitespace() -> ctype isspace()
Ardunio isSpace() -> ctype isblank()

facchinm
This issue tracker is only to be used to report bugs or feature requests. This topic is more appropriate for the Arduino Forum. I'm sure we'll be able to help you with your problem over there.

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CoreRelated to the code for the standard Arduino APIType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions