Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing a string question vb.net
Message
From
02/10/2006 12:44:30
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01158592
Message ID:
01158598
Views:
25
This message has been marked as the solution to the initial question of the thread.
>I hoping someone can help me out with this.
>
>I have a Winform that uses the winsock control to receive an HL7 message. I get the message, as one long string, and now I need to parse it. Each message string has several "segments", each which ends with a CR. In VFP, I would just use the string extract verb to pull out each one (after counting how many CR I found). I'm not sure how to do that in vb.net and am hoping someone can help with some small example and the commands. Below is a copy of a sample string I receive:
>
>
>MSH|^~\&|IWAY|999|CQI|999|20060928131521||ADT^A03|50|P|2.3|50||||US
>EVN|A03|20060928130900|||PAT
>PID|1||27||INTEGRATED^TEST^L||19440905|F||W|12345 ANYWHERE STREET^^NASHVILLE^TN^37202|037|(615)885-5522^~|^~|E|W|C|28|999999999||||ILLINOIS
>PD1||||459^ABU-FADEL^MAZEN^MD|||N||||N|N
>PV1|1|O|LAB|3|||93^CHILDERS^CHRISSY|||LAB||||1||N|93^CHILDERS^CHRISSY|E||M||||||||||||||||01^DISCHARGED TO HOME (ROUTINE)||||||||20060928130900|20060928130900
>DG1|1|I9||SWOLLEN RIGHT FOOT
>GT1|1|25|INTEGRATED^TEST^L||12345 ANYWHERE STREET^^NASHVILLE^TN^37202|(615)885-5522^~|^~||F||18^SELF|999999999|||1|DRUG WAREHOUSE|2214 N 14TH ST^^PONCA CITY^OK^74604|(580)762-3700^~||||||||||||||||||||||||||||^~||||||||M
>IN1|1|2|980|MEDICARE MUTUAL OF OMAHA|PO BOX 1602^^OMAHA^NE^68175||(866)734-6656^~||||DRUG WAREHOUSE||||M|INTEGRATED^TEST^L|18^SELF|19440905||Y|CO|1|||||Y|||||||||87455841552||||||1|F|2214 N 14TH ST^^PONCA CITY^OK^74604|N||3
>IN1|2|2|400|AETNA|PO BOX 981107^^EL PASO^TX^799981107||(888)342-3862^~||||DRUG WAREHOUSE||||C|INTEGRATED^TEST^L|18^SELF|19440905||Y|IN|2|||||Y|||||||||88544552255||||||1|F|2214 N 14TH ST^^PONCA CITY^OK^74604|N||3
>NK1|1|INTEGRATED^LABBY||12345 ANYWHERE STREE^^NASHVILLE^TN^37202|(615)885-5522^~|^~|||||||||||||||||||||||||^~
>NK1|2|NONE^PER^P|||^~|^~|||||||||||||||||||||||||^~
>ACC
>
>
>
>Thanks

Kirk,

Try String.Split("\r") // C#
or String.Split(Chr(10)) -- VB
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform