void Create(string name, CsvType type, string csvText, int headerRow) { this.name = name; this.type = type; Rows.Clear(); //CSVデータを作成 string[] lines = csvText.Split("\n"[0]); for (int i = 0; i < lines.Length; i++) { StringGridRow row = new StringGridRow(GetThis, Rows.Count); row.InitFromCsvText(type, lines[i]); Rows.Add(row); } ParseHeader(headerRow); textLength = csvText.Length; }
private void Create(string name, CsvType type, string csvText, int headerRow) { this.name = name; this.type = type; this.Rows.Clear(); char[] separator = new char[] { "\n"[0] }; string[] strArray = csvText.Split(separator); for (int i = 0; i < strArray.Length; i++) { StringGridRow item = new StringGridRow(this, this.Rows.Count); item.InitFromCsvText(type, strArray[i]); this.Rows.Add(item); } this.ParseHeader(headerRow); this.textLength = csvText.Length; }
void Create(string name, CsvType type, string csvText, int headerRow) { this.name = name; this.type = type; Rows.Clear(); //CSVデータを作成 string[] stringSeparators = new string[] { "\r\n", "\n" }; string[] lines = csvText.Split(stringSeparators, System.StringSplitOptions.None); for (int i = 0; i < lines.Length; i++) { StringGridRow row = new StringGridRow(this, Rows.Count); row.InitFromCsvText(type, lines[i]); Rows.Add(row); } ParseHeader(headerRow); textLength = csvText.Length; }