I am using this code in my Web Api to get data from a csv file, and plug that data into a Item List.

```
 private List<Item> ietms = new List<Item>();

        public ItemRepository()
        {
            string filename = HttpRuntime.AppDomainAppPath + "App_Data\\items.csv";

            var lines = File.ReadAllLines(filename).Skip(1).ToList();

            for (int i = 0; i < lines.Count; i++)
            {
                var line = lines[i];

                var columns = line.Split('$');

                //get rid of newline characters in the middle of data lines
                while (columns.Length < 9)
                {
                    i += 1;
                    line = line.Replace("\n", " ") + lines[i];
                    columns = line.Split('$');
                }

                //Remove Starting and Trailing open quotes from fields
                columns = columns.Select(c => { if (string.IsNullOrEmpty(c) == false) { return c.Substring(1, c.Length - 2); } return string.Empty; }).ToArray();

                items.Add(new Item()
                {
                    Id = int.Parse(columns[0]),
                    Name = columns[1],
                    Description = columns[2],
                    Price = string.IsNullOrEmpty(columns[3].Trim()) ? null : (double?)double.Parse(columns[3]),
                    Weight = columns[8],
                    PhotoUrl = columns[7],
                    Category=columns[9]

                });
            }
        }

```

In the csv file one of the columns/value is structured like this:

```
Groups>Subgroup>item

```

or in some cases

```
MajorGroup|Groups>Subgroup>item

```

How do I pull out only the first value before the > or |, so that I would get the value as `Groups` in the first case and `MajorGroup` in the second, and store it in the `Category` property in the Item List, which is now just set to the entire value in column 9 which would return the whole string "Groups>Subgroup>item".