Commit 8042bfe3 authored by Jess Frazelle's avatar Jess Frazelle Committed by Ian Lance Taylor

encoding/csv: update doc about comments whitespace

This patch updates the doc about comments whitespace for the
encoding/csv package to reflect that leading whitespace before
the hash will treat the line as not a comment.

Fixes #13775.

Change-Id: Ia468c75b242a487b4b2b4cd3d342bfb8e07720ba
Reviewed-on: https://go-review.googlesource.com/23302Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent cbc26869
...@@ -86,30 +86,31 @@ var ( ...@@ -86,30 +86,31 @@ var (
// The exported fields can be changed to customize the details before the // The exported fields can be changed to customize the details before the
// first call to Read or ReadAll. // first call to Read or ReadAll.
// //
// Comma is the field delimiter. It defaults to ','.
// //
// Comment, if not 0, is the comment character. Lines beginning with the
// Comment character are ignored.
//
// If FieldsPerRecord is positive, Read requires each record to
// have the given number of fields. If FieldsPerRecord is 0, Read sets it to
// the number of fields in the first record, so that future records must
// have the same field count. If FieldsPerRecord is negative, no check is
// made and records may have a variable number of fields.
//
// If LazyQuotes is true, a quote may appear in an unquoted field and a
// non-doubled quote may appear in a quoted field.
//
// If TrimLeadingSpace is true, leading white space in a field is ignored.
// If the field delimiter is white space, TrimLeadingSpace will trim the
// delimiter.
type Reader struct { type Reader struct {
Comma rune // field delimiter (set to ',' by NewReader) // Comma is the field delimiter.
Comment rune // comment character for start of line // It is set to comma (',') by NewReader.
FieldsPerRecord int // number of expected fields per record Comma rune
LazyQuotes bool // allow lazy quotes // Comment, if not 0, is the comment character. Lines beginning with the
// Comment character without preceding whitespace are ignored.
// With leading whitespace the Comment character becomes part of the
// field, even if TrimLeadingSpace is true.
Comment rune
// FieldsPerRecord is the number of expected fields per record.
// If FieldsPerRecord is positive, Read requires each record to
// have the given number of fields. If FieldsPerRecord is 0, Read sets it to
// the number of fields in the first record, so that future records must
// have the same field count. If FieldsPerRecord is negative, no check is
// made and records may have a variable number of fields.
FieldsPerRecord int
// If LazyQuotes is true, a quote may appear in an unquoted field and a
// non-doubled quote may appear in a quoted field.
LazyQuotes bool
TrailingComma bool // ignored; here for backwards compatibility TrailingComma bool // ignored; here for backwards compatibility
TrimLeadingSpace bool // trim leading space // If TrimLeadingSpace is true, leading white space in a field is ignored.
// This is done even if the field delimiter, Comma, is white space.
TrimLeadingSpace bool
line int line int
column int column int
r *bufio.Reader r *bufio.Reader
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment