How can I read lines from a file where the line endings are carriage return (CR), newline (NL), or both?
The PDF specification allows lines to end with CR, LF, or CRLF.
bufio.Reader.ReadString()
andbufio.Reader.ReadBytes()
allow a single delimiter byte.-
bufio.Scanner.Scan()
handles, but not a lone
.
The end-of-line marker is one optional carriage return followed by one mandatory newline.
Do I need to write my own function that uses bufio.Reader.ReadByte()
?