Skip to content

Commit 52e7c3b

Browse files
committed
Adding null return for ReadStringUntil or equivalent for readBytesUntil
1 parent 1625ca1 commit 52e7c3b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Language/Functions/Communication/Serial/readStringUntil.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ title: Serial.readStringUntil()
3333

3434
[float]
3535
=== Returns
36-
The entire `String` read from the serial buffer, up to the terminator character
36+
The entire `String` read from the serial buffer, up to the terminator character.
37+
If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`.
3738

3839
--
3940
// OVERVIEW SECTION ENDS
@@ -46,6 +47,7 @@ The entire `String` read from the serial buffer, up to the terminator character
4647
[float]
4748
=== Notes and Warnings
4849
The terminator character is discarded from the serial buffer.
50+
If the terminator character can't be found, all read characters will be discarded.
4951
[%hardbreaks]
5052

5153
--

Language/Functions/Communication/Stream/streamReadBytesUntil.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ title: Stream.readBytesUntil()
1616
=== Description
1717
`readBytesUntil()` reads characters from a stream into a buffer. The function terminates if the terminator character is detected, the determined length has been read, or it times out (see link:../streamsettimeout[setTimeout()]). The function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer.
1818

19-
`readBytesUntil()` returns the number of bytes placed in the buffer. A 0 means no valid data was found.
19+
`readBytesUntil()` returns the number of bytes placed in the buffer. A 0 means the terminator character can't be found or there is no data before it.
2020

2121
This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information.
2222
[%hardbreaks]
@@ -37,7 +37,7 @@ This function is part of the Stream class, and can be called by any class that i
3737

3838
[float]
3939
=== Returns
40-
The number of bytes placed in the buffer.
40+
The number of bytes (excluding the terminator character) placed in the buffer if the terminator character has been found.
4141

4242
--
4343
// OVERVIEW SECTION ENDS

Language/Functions/Communication/Stream/streamReadStringUntil.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ This function is part of the Stream class, and can be called by any class that i
3333

3434
[float]
3535
=== Returns
36-
The entire String read from a stream, up to the terminator character
36+
The entire String read from a stream, up to the terminator character.
37+
If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`.
3738

3839
--
3940
// OVERVIEW SECTION ENDS
@@ -46,6 +47,7 @@ The entire String read from a stream, up to the terminator character
4647
[float]
4748
=== Notes and Warnings
4849
The terminator character is discarded from the stream.
50+
If the terminator character can't be found, all read characters will be discarded.
4951
[%hardbreaks]
5052

5153
--

0 commit comments

Comments
 (0)