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);
        }
Exemplo n.º 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);
        }