public static RowData Distint(this RowData rd) { if (rd.data.Length > 2) { string[] tmp = new string[2]; tmp[0] = rd.data[0]; tmp[1] = rd.data[1]; return(new RowData(tmp)); } return(rd); }
public void ToClass() { Dictionary <int, List <RowData> > res = new Dictionary <int, List <RowData> >(); int num = this.data.Count; int gNum = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(num) / 4)); this.dataCount = num; this.dividCount = gNum; int iter = 0; bool IsSave = false; List <RowData> rd = new List <RowData>(); for (int kk = 0; kk < num; kk++) { IsSave = false; rd.Add(this.data[kk]); if ((kk + 1) % gNum == 0) { res[iter] = new List <RowData>(rd); iter++; rd = new List <RowData>(); IsSave = true; } } if (!IsSave) { res[iter] = rd; } List <ColData> CLs = new List <ColData>(); foreach (List <RowData> item in res.Values) { List <ColData> ii = item.ToStringArray().ToColData(); CLs.AddRange(ii); } RowData header = new RowData(new string[] { CROSS_DATA.year, CROSS_DATA.number, this.NAME, this.dataCount.ToString(), this.dividCount.ToString(), CROSS_DATA.month }); RowData blockRow = new RowData(new string[] { "" }); List <RowData> newRd = CLs.ToStringArray().ToRowData(); newRd.Insert(0, blockRow); newRd.Insert(0, header); Results = newRd; }
public static bool IsEmpty(this RowData data) { foreach (string item in data.data) { if (item.Trim() != "") { return(false); } } return(true); }
public static string ToOutFormat(this RowData rd) { string res = ""; foreach (string d in rd.data) { string item = null == d ? "" : d; bool IsDouble = double.TryParse(item, out double dd); string tmp = IsDouble ? dd.ToString() : item; res = res + tmp.ToBlockData(); } return(res); }