Although this post is related to serial events, they managed the incoming data not in a good way. The key point is to make sure you are not manipulating or accessing null objects. When you apply calls using substring, you are assuming your incoming data has so many delimiters. Don't assume but check first before accessing the data. It will save you lots of headaches. You will need to add some extra code. This is part of the design game.
Answers
you tell us, it's your code!
what is input?
(substring cuts down a string. the 2 is the start position, the indexOf is the end position (which is itself looking for a newline within the string))
returns "ample", so it's picking from after the 2nd character until just before the first newline.
your ArrayIndexOutOfBounds suggests that your input is shorter than 2. debug using:
(that code also breaks if there's no newline in the string. it is actually quite poor code)
Check this recent post: https://forum.processing.org/two/discussion/comment/100930/#Comment_100930
Although this post is related to serial events, they managed the incoming data not in a good way. The key point is to make sure you are not manipulating or accessing null objects. When you apply calls using substring, you are assuming your incoming data has so many delimiters. Don't assume but check first before accessing the data. It will save you lots of headaches. You will need to add some extra code. This is part of the
designgame.Kf