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(); }
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(); }