예제 #1
0
        public ExplodeStringEngine(string lineText, ExplodeOptions opts)
        {
            this.Opts = opts;
            this.Chrs = opts.Delimiters;

            this.LineText   = lineText;
            this.LineLength = lineText.Length;
        }
예제 #2
0
        public static ExplodeResult Explode(this string text, ExplodeOptions opts)
        {
            ExplodeResult       res    = new();
            ExplodeStringEngine engine = new(text, opts);

            if (opts.EnableTextDelimiter && 0 == opts.Delimiters.TextDelimiterLength)
            {
                throw new Exception("Call to Split when Text Delimiter character has not been set");
            }

            while (!engine.IsProcessingComplete)
            {
                Cell cell = engine.GetNextCell();
                res.Add(cell);

                //Set flag is any cells contained within text delimiter[s]
                if (cell.WasTextDelimited && !res.WereAnyCellsTextDelimited)
                {
                    res.WereAnyCellsTextDelimited = true;
                }
            }

            return(res);
        }
예제 #3
0
 public static ExplodeResult ExplodeString(string text, ExplodeOptions opts)
 {
     return(text.Explode(opts));
 }