public Segment(string segmentText, FieldSepandEncodingChars fs) { //---------check for escaped charachters here Escape e = new Escape(segmentText.Trim(), fs.fieldSeparator); string[] ss = segmentText.Trim().Split(fs.fieldSeparator); foreach (string s in ss) { Field f = new Field(e.escapedString, fs); Fields.Add(f); } value = segmentText; }
public Field(string fieldText, FieldSepandEncodingChars fc) { //------test if this is a repeating field that is NOT MSH1 if ((fieldText.Contains(fc.fieldRepeatSeparator)) && (fc.fieldSeparator.ToString() + fieldText != fc.allSpecialChars)) { //create a subfield on the "~" delimiter string[] ss = fieldText.Split(fc.fieldRepeatSeparator); //---split the "~" delimited string foreach (string s in ss) { SubField f = new SubField(s, fc); SubFields.Add(f); } } else { if (fc.fieldSeparator.ToString() + fieldText == fc.allSpecialChars) { fieldValue = fc.fieldSeparator.ToString() + fieldText; } else { if (!fieldText.Contains(fc.subSubFieldSeparator)) { fieldValue = fieldText; } else { //----test to find position of the '&' int index = fieldText.IndexOf(fc.subSubFieldSeparator); int len = fieldText.Length; int i = 0; while (i <= len) { // start+count must be a position within -str-. if (fieldText.Substring(0, 1) == fc.escapeCharacter.ToString()) { //this is an escaped subsubfield char } else { } index++; i++; } SubSubField ss = new SubSubField(fieldText, fc); } } } }
public SubSubField(string subSubFieldText, FieldSepandEncodingChars f) { if (subSubFieldText.Contains(f.subSubFieldSeparator)) { string[] ss = subSubFieldText.Split(f.subSubFieldSeparator); foreach (string s in ss) { SubSubFields.Add(s); } } else if (subSubFieldText != null) { value = subSubFieldText; } }
public HL7Message(string messageText) { ss = messageText.Trim().Split('\r'); //--need to test for escape characters foreach (string s in ss) { if (s.Length > 0) { if (s.Substring(0, 3) == "MSH") { fsChars = new FieldSepandEncodingChars(s.Substring(3, 5)); } Segment seg = new Segment(s, fsChars); Segments.Add(seg); } } value = messageText.Trim(); }