src/Foundation/Text/Gimela.Text/Readers/StringReader.cs
/// <summary>
/// Will read until specified delimiter is found.
/// </summary>
/// <param name="delimiter">Character to stop at.</param>
/// <returns>
/// A string if the delimiter was found; otherwise <c>null</c>.
/// </returns>
/// <remarks>
/// Will trim away spaces and tabs from the end.
/// Will not consume the delimiter.
/// </remarks>
/// <exception cref="InvalidOperationException"><c>InvalidOperationException</c>.</exception>
Will read until specified delimiter is found.
Will read until specified delimiter is found .
public string ReadUntil(char delimiter)
    {
      if (EOF)
        return null;
      int startIndex = Index;
      while (true)
      {
        if (EOF)
        {
          Index = startIndex;
          return null;
        }
        if (Current == delimiter)
          return GetString(startIndex, Index, true);
        if (delimiter != '\r' && delimiter != '\n' && Current == '\r' || Current == '\n')
          throw new InvalidOperationException("Unexpected new line: " + GetString(startIndex, Index) +
                                              "[CRLF].");
        ++Index;
      }
    }
public string ReadUntil ( char delimiter ) { if ( EOF ) return null ; int startIndex = Index ; while ( true ) { if ( EOF ) { Index = startIndex ; return null ; } if ( Current == delimiter ) return GetString ( startIndex , Index , true ) ; if ( delimiter != ' \r ' && delimiter != ' \n ' && Current == ' \r ' || Current == ' \n ' ) throw new InvalidOperationException ( " " + GetString ( startIndex , Index ) + " " ) ; ++ Index ; } }
Will read until specified delimiter is found.
Will read until specified delimiter is found .
// Delimiter is not new line and we got one.
A string if the delimiter was found; otherwise null
A string if the delimiter was found ; otherwise null
None
delimiter
char
Character to stop at.
Character to stop at .
remarks
Will trim away spaces and tabs from the end.
Will not consume the delimiter.
Will trim away spaces and tabs from the end . Will not consume the delimiter .