Trouble Parsing with Indexof
I am trying to use indexof to parse serial data and extract data between @ and #.
int start = data.IndexOf('@') + 1;
int end = data.IndexOf('#', start);
string result = data.substring (start, end - start -1)
but sometimes the string does not stop at # and I get extra data. What is a good way to effectively filter out everything outside of the @ and #.
Note: If the data being processed is from a pre-existing string, then it works fine. The problem is when the data comes in from a serial port (stream)