|
-
Jan 9th, 2000, 02:16 AM
#1
Thread Starter
New Member
I have the following data streaming in from a serial device:
"Wxxx Fxxxxxxxx|ID S xxxxxx|ID E xxxxxx|Wxxx Fxxxxxxxx"
I need to parse it so that when the code see's the "|", it will do a carriage return and the data streaming in from the serial device will look like this:
Wxxx Fxxxxxxxx
ID S xxxxxx
ID E xxxxxx
Wxxx Fxxxxxxxx
I appreciate any help or code snippets you can offer. this is my first attempt at programming!
Regards,
Michael
-
Jan 9th, 2000, 02:20 AM
#2
Guru
Assuming you are using VB6:
Code:
Dim str As String
Dim newstr As String
str = "Wxxx Fxxxxxxxx|ID S xxxxxx|ID E xxxxxx|Wxxx Fxxxxxxxx"
newstr = Replace(str, "|", vbCrLf)
MsgBox newstr
Tom
-
Jan 9th, 2000, 02:21 AM
#3
or you could do this if you need to edit the data rapidly
dim Mystring$ 'contains serial data
dim MyArray() 'variant array
dim i% 'for...next counter
myarray = split(mystring, "|") 'cuts up the 'data into segments between the pipe 'characters "|".
for i = 0 to ubound(myarray)
me.print myarray(i)
next i
[email protected]
[This message has been edited by wossname (edited 01-09-2000).]
-
Jan 9th, 2000, 04:07 AM
#4
Thread Starter
New Member
I need to add that the data stream coming in from the serial port will be in random order, and will always be broken up by "|".
I also want to display this data in a text box....
thank you for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|