如何选择,识别和保存使用管道符号作为分隔符分隔的单个字段。 [英] How do I pick, recognize and save individual fields separated using pipe symbol as delimiter.
问题描述
我正在使用C#中的visual studio 2013构建应用程序。
我想选择,识别并保存使用管道符号作为分隔符分隔的单个字段。
这是HL7消息,我需要打破字段并根据它的位置保存它。
例如:
MSH | ^〜\& || SJH ||| 201606131008 || ADT ^ A04 | ADT.1.32125 | D | 2.1
我将此行粘贴在文本框中。单击一个按钮,根据字段保存数据库中的字段,例如:ADT ^ 04应保存在数据库的messagetype字段中,依此类推。
< b>我尝试了什么:
我根本不知道如何从一条线上挑选这些细节。因此,我需要帮助。
I am building an app using visual studio 2013 in C#.
I want to pick, recognize and save individual fields separated using pipe symbol as delimiter.
It's the HL7 message that I need to break into fields and save it according to it's position.
eg:
MSH|^~\&||SJH|||201606131008||ADT^A04|ADT.1.32125|D|2.1
I paste this line in a text box. Click on a button that would save the fields in database according to the fields, eg: ADT^04 should be saved in messagetype field in database and so on.
What I have tried:
I do not know at all how to pick such details from a line. Hence, I need help.
推荐答案
你见过string.Split()吗? String.Split方法(Char [])(系统) [ ^ ]
have you seen string.Split() ? String.Split Method (Char[]) (System)[^]
我根本不知道如何从一行中选择这些细节。
I do not know at all how to pick such details from a line.
正确学习C#。
对于您的问题,您需要了解字符串函数和操作。答案就在那里。
Learn properly C#.
For your problem, you need to learn about string functions and operations. The answers are there.
这篇关于如何选择,识别和保存使用管道符号作为分隔符分隔的单个字段。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!