
Originally Posted by
LiamC
In the case were we would only use one serialport.write to avoid 2 iterations of serialdata received event, how would you parse a string like this one:
Code:
response = 20.000{CR}{LF}0.000{CR}{LF}
knowing that the number of useful characters (positions) can change the next time a response is triggered by a user click on the "verify position" button ?
Food for thought
Code:
'test message
Dim response As String = "20.0" & vbCrLf & "10.123" & vbCrLf
'I picked 255 because it is not normally an ASCII value seen
response = response.Replace(vbCrLf, Chr(255)) 'change the two character CRLF to a single char
Dim parts() As String = response.Split(New Char() {Chr(255)}, StringSplitOptions.RemoveEmptyEntries)
For Each p As String In parts
Debug.WriteLine(p)
Next