aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Stream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/Stream.cpp')
-rw-r--r--cores/arduino/Stream.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp
index 3d5b905..aafb7fc 100644
--- a/cores/arduino/Stream.cpp
+++ b/cores/arduino/Stream.cpp
@@ -244,3 +244,27 @@ size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length)
return index; // return number of characters, not including null terminator
}
+String Stream::readString()
+{
+ String ret;
+ int c = timedRead();
+ while (c >= 0)
+ {
+ ret += (char)c;
+ c = timedRead();
+ }
+ return ret;
+}
+
+String Stream::readStringUntil(char terminator)
+{
+ String ret;
+ int c = timedRead();
+ while (c >= 0 && c != terminator)
+ {
+ ret += (char)c;
+ c = timedRead();
+ }
+ return ret;
+}
+