public static Segment GetSegment(this string str, string delim)
 {
     var seg = new Segment { Contents = str };
     string[] els = str.Split(delim.ToCharArray());
     seg.Label = els[0].GetSegmentLabel();
     return seg;
 }
 private static void build_list_list(Segment seg, SegmentLabel looplabel, ref List<Segment> subList, List<List<Segment>> listList)
 {
     if(seg.Label == looplabel && subList.Count > 0)
     {
         listList.Add(subList);
         subList = new List<Segment>();
     }
     subList.Add(seg);
 }
 private static void add_line_response_element(Segment seg, ICollection<LineResponseElementEntity> responseEls)
 {
     var elDelim = seg.Contents.Substring(3, 1);
     var arr = seg.GetElements(elDelim);
     responseEls.Add(new LineResponseElementEntity
     {
         ElementName = "REF02",
         Qualifier = arr[1],
         Value = arr[2]
     });
 }