I donβt know exactly what you need, but you can do this:
if you have string str with all the text in it, you can do
string[] lines = str.Split('\n');
and then for each line you can do
string[] cells = line.Split('|');
if we go to the next level we can do:
public class line { public int ItemNumber { get; set; } public string ProductStatus { get; set; } public int UPC { get; set; } public line(string currLine) { string[] cells = currLine.Split('|'); int item; if(int.TryParse(cells[0], out item)) { ItemNumber = item; } ProductStatus = cells[1]; int upc; if (int.TryParse(cells[2], out upc)) { UPC = upc; } } }
and then:
string[] lines = str.Substring(str.IndexOf("\n")).Split('\n');// split it to lines; List<line> tblLines = new List<line>(); foreach(string curr in lines) { tblLines.Add(new line(curr); }
No Idea For Name
source share