Skip to content
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

add Stream::readStringUntil function that uses string terminator #9011

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

Arian8j2
Copy link
Contributor

currently there is a

String readStringUntil(char terminator)

function, but there is no equivalent of it that uses string terminator. this pr implements

String readStringUntil(const char* terminator, uint32_t count = 1)

i found this useful for small html parsing or truncating.

@d-a-v
Copy link
Collaborator

d-a-v commented Nov 4, 2023

It is not a breaking change and does not override the Arduino API, so looks good.
However the count name is not intuitive.
Is it a int until_total_number_of_occurrences = 1 ?

@Arian8j2
Copy link
Contributor Author

Arian8j2 commented Nov 4, 2023

Is it a int until_total_number_of_occurrences = 1 ?

yes

@d-a-v
Copy link
Collaborator

d-a-v commented Nov 6, 2023

Can you please add a comment or rename the variable ?

@Arian8j2
Copy link
Contributor Author

Arian8j2 commented Nov 7, 2023

Can you please add a comment or rename the variable ?

done

Copy link
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: Next step is to simplify our calls to readStringUntil() from our libraries (especially but not only parsing-impl.h)

edit (or improve Stream::sendUntil() with this same new API) - see #9005)

@d-a-v d-a-v merged commit 31c1592 into esp8266:master Nov 7, 2023
28 checks passed
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
…8266#9011)

* add readStringUntil function with string terminator
* rename count parameter to untilTotalNumberOfOccurrences
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

Successfully merging this pull request may close these issues.

2 participants