public (string, IEnumerable <int>) ParseVisit(string visit) { var entries = LinesSplitter.SplitLine(visit, StringDelimeter, StringSeparator); if (entries.Count != FieldsCount) { throw new System.Exception("Visits data should contain library name, 12 values for months and YTD column (14 total)"); } return(entries.First().TrimStart().TrimEnd('*', ' '), entries.Skip(1).Select(_ => int.Parse(_))); }
public Library GetLibrary(string line, char separator = ',') { if (line == null) { throw new ArgumentNullException(nameof(line)); } var lineValues = LinesSplitter.SplitLine(line, StringDelimeter, separator); if (lineValues.Count != FieldsCount) { throw new InvalidOperationException($"Parser supports only {FieldsCount} fields data sets."); } return(CreateLibrary(lineValues)); }