Skip to content

Define "whitespace" in String trim reference #707

Open
@jellewie

Description

@jellewie

https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/trim/
It states that it removes 'any leading and trailing whitespace'
'whitespace' isn't declared, Some websites states that /r/n are also whitespaces (char 10+13) but it does not remove these.

What happened
a string with /r/n at the end, did not get the /r/n removed
String a = "test" + char(10) + Char(13);
Serial.print(a.trim().length());

What I expected
That the /r and /n were removed from the string (they are whitespaces in my opinion)

What should happen
Either

  1. Update the website to state what the 'whitespaces' are, and thus what it removes with 'trim()'
  2. That the function is to be fixed and /r and /n being added to 'trim()' (and update the webpage?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions