Example #1
0
        internal static SimpleSegment NextLineDelimiter(ITextSource content, Int32 offset)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }
            Int32 contentLength = content.Length;
            Int32 pos           = content.IndexOfAny(LineChars, offset, contentLength - offset);

            if (pos >= 0)
            {
                if (content.GetCharacterAt(pos) == '\r' && pos + 1 < content.Length && content.GetCharacterAt(pos + 1) == '\n')
                {
                    return(new SimpleSegment(pos, 2));
                }
                return(new SimpleSegment(pos, 1));
            }
            return(SimpleSegment.Invalid);
        }