/// <summary> /// Returns the ending offset found by matching characters with testSet, /// until a position is found that doen't match /// </summary> /// /// <param name="string"></param> /// <param name="offset"></param> /// <param name="testSet"></param> /// <returns></returns> public int Span(String str0, int offset, UnicodeSet testSet) { while (true) { int newOffset = testSet.MatchesAt(str0, offset); if (newOffset < 0) { return(offset); } } }
/// <summary> /// Returns the ending offset found by matching characters with testSet, /// until a position is found that does match /// </summary> /// /// <param name="string"></param> /// <param name="offset"></param> /// <param name="testSet"></param> /// <returns></returns> public int SpanNot(String str0, int offset, UnicodeSet testSet) { while (true) { int newOffset = testSet.MatchesAt(str0, offset); if (newOffset >= 0) { return(offset); } ++offset; // try next character position // we don't have to worry about surrogates for this. } }