The objective is to create a string from a list of byte format. The list consists of a series of short commands composed of 2-5 bytes and ending with a ";" character. The code should peal off the first command to the delimiter. Here's the code currently used:
Since the todo array gets converted to a string a bit later in the program, I want to just define it as a string to begin with and convert directly from the byte list to a string, but stopping the conversion when the delimiter is encountered. I haven't seen any VB capability to do that directly. Any help?Code:dim SP2buf as new list(of byte)(2000) dim todo(1000) as char dim SP2idx as integer If SP2buf.Count > 0 Then SP2idx = SP2buf.IndexOf(59) 'find the ; delimiter If SP2idx >= 0 Then ' is the ; there todo = (SP2.Encoding.GetChars(SP2buf.ToArray, 0, SP2idx)) End If End If




Reply With Quote
