This page is also available in 2 other languages

Serial.readStringUntil()

Description

readStringUntil() reads characters from the serial buffer into a String. The function terminates if it times out (see setTimeout()).

Serial.readStringUntil() inherits from the Stream utility class.

Syntax

Serial.readStringUntil(terminator)

Parameters

Serial: serial port object. See the list of available serial ports for each board on the Serial main page.
terminator: the character to search for. Allowed data types: char.

Returns

The entire String read from the serial buffer, up to the terminator character. If the terminator character can’t be found, or if there is no data before the terminator character, it will return NULL.

Notes and Warnings

The terminator character is discarded from the serial buffer. If the terminator character can’t be found, all read characters will be discarded.

See also