Description

readStringUntil() reads characters from a stream into a String. The function terminates if the terminator character is detected or it times out (see Stream.setTimeout()). The terminator character is not included in the returned String.

This function is similar to readBytesUntil(), but returns a String object instead of storing the data in a buffer.

This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the Stream class main page for more information.

Syntax

stream.readStringUntil(terminator)

Parameters

  • terminator: the character to search for. Allowed data types: char.

Returns

A String containing the characters read from the stream, up to (but not including) the terminator character. If the operation times out before finding the terminator, it returns the characters read up to that point (which may be an empty String if no data was available). Data type: String.

Notes and Warnings

The terminator character is discarded from the stream.