private static CharacterCountingIterator GetCharacterCountingIterator(this ISegment segment, int startIndex)
        {
            Location startLocation = new Location(segment, true);


            CharacterCountingIterator counter = new CharacterCountingIterator(startLocation,
                                                                              GetStartCountingVisitor,
                                                                              GetEndCountingVisitor);

            while (counter.CharacterCount <= startIndex)
            {
                if (!counter.MoveNext())
                {
                    break;
                }
            }
            counter.MovePrevious();
            return(counter);
        }
Exemple #2
0
        private static CharacterCountingIterator GetCharacterCountingIterator(this ISegment segment, int startIndex)
        {
            Location startLocation = new Location(segment, true);


            CharacterCountingIterator counter = new CharacterCountingIterator(startLocation,
                                                                              () => new StartOfItemCharacterCounterNoTagsVisitor(),
                                                                              () => new EndOfItemCharacterCounterNoTagsVisitor());

            while (counter.CharacterCount <= startIndex)
            {
                if (!counter.MoveNext())
                {
                    break;
                }
            }
            counter.MovePrevious();
            return(counter);
        }