Skip to content

readStringUntil(): unclear whether including or not including delimiter #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
teo1978 opened this issue Sep 30, 2018 · 1 comment
Closed

Comments

@teo1978
Copy link

teo1978 commented Sep 30, 2018

https://www.arduino.cc/en/Reference/StreamReadStringUntil

readStringUntil() reads characters from a stream into a string. The function terminates if the terminator character is detected or it times out

Returns
The entire string read from a stream, until the terminator character is detected

It is unclear whether the returned string includes the terminator or not.

I seem to understand it is included; if that is the case, it could easily be stated more explicitly.

@per1234
Copy link
Collaborator

per1234 commented Sep 30, 2018

I'm merging in arduino/Arduino#6137 because this is now the more appropriate place for that issue.

jzaruba commented on Mar 30, 2017

https://www.arduino.cc/en/Serial/ReadStringUntil
It is not clear whether the returned value contains the terminator or not. (I read elsewhere that it does not.) And what happens to the terminator? Is it returned in the next Serial.read or is it thrown away?


inflector commented on Dec 5, 2017

From testing the code, the answer to this question is:

  1. It does NOT return the terminator.
  2. It does NOT leave it in the buffer and return it the next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants