reference-en icon indicating copy to clipboard operation
reference-en copied to clipboard

Behavior not documented: Stream.find() consumes the bytes and also the matched byte.

Open yck011522 opened this issue 6 years ago • 3 comments

I'm refering to this function: https://www.arduino.cc/reference/en/language/functions/communication/stream/streamfind/

The behavior of the function Stream.find() is that it will consume every single byte in the inBuffer until it fins the matching target.

This is not documented nor expected from the name find(). One can expect a find() function to behave similar to peek() but it is not.

yck011522 avatar Sep 13 '19 11:09 yck011522

Hi @yck011522 I think that would be a good thing to document. Would you like to submit a pull request to make this improvement?

per1234 avatar Sep 13 '19 15:09 per1234

Hi @per1234. Glad you agree with me. Sorry I do not have the time now. Perhaps some other people is able give it a try.

yck011522 avatar Sep 14 '19 09:09 yck011522

I understand, no problem. Your suggestion is valuable in itself. I'm sure someone will act on this in the near future.

Thanks! Per

per1234 avatar Sep 14 '19 09:09 per1234