/// <summary> /// Advances the reader and reads until a substring specified by <paramref name="indicator" /> is encountered. /// The reader's position after executing this method depends on the <paramref name="options" />. /// </summary> /// <param name="indicator">The reader stops when an occurrence of this string instance is encountered.</param> /// <param name="options">Specifies the reading options.</param> /// <returns> /// A substring read from the underlying string instance. /// </returns> public string ReadTo(string indicator, ReadOptions options = ReadOptions.StopAfterKey | ReadOptions.DiscardKey) { var idx = options.HasFlag(ReadOptions.InLine) ? UnderlyingString.InlineIndexOf(indicator, CurrentPosition, EndPosition - CurrentPosition, ComparisonType) : UnderlyingString.IndexOf(indicator, CurrentPosition, EndPosition - CurrentPosition, ComparisonType); return(_innerReadTo(idx, indicator.Length, options)); }