p5.serialserver icon indicating copy to clipboard operation
p5.serialserver copied to clipboard

readLine and readStringUntil shouldn't return search characters?

Open vanevery opened this issue 10 years ago • 2 comments

vanevery avatar Oct 02 '15 21:10 vanevery

Hmmn.. I think that the issue isn't that it is returning the search characters, it is retuning an empty string when the search characters aren't found. If this isn't the appropriate behavior, what should the appropriate behavior be?

@lmccart @shiffman @tigoe

vanevery avatar Oct 03 '15 20:10 vanevery

I'd take a look at how Processing implements these and do the same. I believe readStringUntil(x) returns x as well as the string that comes before it. This is why I usually trim() the results of it. There are times when you need the delimiter (which I assume is what you mean by search) characters.

readLine() on the other hand, I think should automatically trim any newline or return. Though there may be use cases where that's a bad idea. Can anyone thing of one?

tigoe avatar Oct 04 '15 16:10 tigoe