As @allObjects suggests, the GPS module is a good example - just use indexOfand substr to search for newlines and split the string. (or you could use str.split("\n") and deal with the array that comes out the end of it).
If you were dealing with particularly long lines you could use indexOf on the data coming in rather than the whole line, but for <50 byte packets the way that's used there is going to work great and is reasonably simple.
© Espruino, powered by microcosm.
Report a problem