src/Foundation/Text/Gimela.Text/Readers/StringReader.cs
/// <summary>
/// Read until one of the delimiters are found.
/// </summary>
/// <param name="delimiters">characters to stop at</param>
/// <returns>
/// A string if one of the delimiters was found; otherwise <c>null</c>.
/// </returns>
/// <remarks>
/// Will not consume the delimiter.
/// </remarks>
/// <exception cref="InvalidOperationException"><c>InvalidOperationException</c>.</exception>
Read until one of the delimiters are found.
Read until one of the delimiters are found .
public string ReadUntil(string delimiters)
    {
      if (EOF)
        return null;
      int startIndex = Index;
      bool isDelimitersNewLine = delimiters.IndexOfAny(new[] { '\r', '\n' }) != -1;
      while (true)
      {
        if (EOF)
        {
          Index = startIndex;
          return null;
        }
        if (delimiters.IndexOf(Current) != -1)
          return GetString(startIndex, Index, true);
        if (isDelimitersNewLine && Current == '\r' || Current == '\n')
          throw new InvalidOperationException("Unexpected new line: " + GetString(startIndex, Index) +
                                              "[CRLF].");
        ++Index;
      }
    }
public string ReadUntil ( string delimiters ) { if ( EOF ) return null ; int startIndex = Index ; bool isDelimitersNewLine = delimiters . IndexOfAny ( new [ ] { ' \r ' , ' \n ' } ) != - 1 ; while ( true ) { if ( EOF ) { Index = startIndex ; return null ; } if ( delimiters . IndexOf ( Current ) != - 1 ) return GetString ( startIndex , Index , true ) ; if ( isDelimitersNewLine && Current == ' \r ' || Current == ' \n ' ) throw new InvalidOperationException ( " " + GetString ( startIndex , Index ) + " " ) ; ++ Index ; } }
Read until one of the delimiters are found.
Read until one of the delimiters are found .
// Delimiter is not new line and we got one.
A string if one of the delimiters was found; otherwise null
A string if one of the delimiters was found ; otherwise null
None
delimiters
string
characters to stop at
characters to stop at
remarks
Will not consume the delimiter.
Will not consume the delimiter .