public IEnumerator <NSRange> GetEnumerator()
        {
            var position = _range.StartIndex;

            Completion.Change(position);

            while (position < _range.EndIndex)
            {
                var misspelled = _textChecker.RangeOfMisspelledWordInString(_plainText,
                                                                            new NSRange(0, _plainText.Length), position, false, "ru_RU");

                if (misspelled.Location == NSRange.NotFound)
                {
                    Completion.MarkCompleted();

                    yield break;
                }

                yield return(misspelled);

                position = (int)misspelled.Location + (int)misspelled.Length + 1;

                Completion.Change(position);
            }

            Completion.MarkCompleted();
        }
示例#2
0
        public IEnumerator <ITextRange> GetEnumerator()
        {
            var index = 0;

            var plainText = _text.Value.PlainText;

            for (int i = 0; i < _text.Value.Length; i++)
            {
                var c = plainText[i];

                if (_stops.Contains(c))
                {
                    yield return(_text.Value.Substring(index, i - index));

                    index = i + 1;
                }

                Completion.Increment();
            }

            yield return(_text.Value.Substring(index, plainText.Length - index));

            Completion.MarkCompleted();
        }
示例#3
0
        public IEnumerator <int> GetEnumerator()
        {
            var index = 0;

            yield return(index);

            var found = false;

            for (int i = 0; i < _text.Length; i++)
            {
                if (found)
                {
                    var c = _text[i];

                    if (char.IsLetterOrDigit(c))
                    {
                        found = false;

                        yield return(i);
                    }
                }
                else
                {
                    var c = _text[i];

                    if (_stops.Contains(c))
                    {
                        found = true;
                    }
                }

                Completion.Increment();
            }

            Completion.MarkCompleted();
        }