aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-05-26 18:16:41 -0700
committerRob Pike <r@golang.org>2010-05-26 18:16:41 -0700
commit7ee6d44e4f34e648a1698a69ff2c6344910a3b62 (patch)
tree04967cfc81b0e551540590e5cc757baf8f5d0bf4
parent6965b407dd60ad3c5e2730c45aacbf0072f91d2e (diff)
downloadgo-7ee6d44e4f34e648a1698a69ff2c6344910a3b62.tar.gz
go-7ee6d44e4f34e648a1698a69ff2c6344910a3b62.zip
fmt.Scan: custom formatters
R=rsc CC=golang-dev https://golang.org/cl/1315042
-rw-r--r--src/pkg/fmt/scan.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/pkg/fmt/scan.go b/src/pkg/fmt/scan.go
index 2a3a624911..b082399fa4 100644
--- a/src/pkg/fmt/scan.go
+++ b/src/pkg/fmt/scan.go
@@ -181,11 +181,11 @@ func (s *ss) token() string {
return s.buf.String()
}
-// Scan parses text read from r, storing successive space-separated
-// values into successive arguments. Newlines count as space. Each
-// argument must be a pointer to a basic type. It returns the number of
-// items successfully parsed. If that is less than the number of arguments,
-// err will report why.
+// Scan parses text read from r, storing successive space-separated values
+// into successive arguments. Newlines count as space. Each argument must
+// be a pointer to a basic type or an implementation of the Scanner
+// interface. It returns the number of items successfully parsed. If that
+// is less than the number of arguments, err will report why.
func Scan(r io.Reader, a ...interface{}) (n int, err os.Error) {
s := newScanState(r, true)
n = s.doScan(a)
@@ -194,12 +194,12 @@ func Scan(r io.Reader, a ...interface{}) (n int, err os.Error) {
return
}
-// Scanln parses text read from r, storing successive space-separated
-// values into successive arguments. Scanning stops at a newline and after
-// the final item there must be a newline or EOF. Each argument must be a
-// pointer to a basic type. It returns the number of items successfully
-// parsed. If that is less than the number of arguments, err will report
-// why.
+// Scanln parses text read from r, storing successive space-separated values
+// into successive arguments. Scanning stops at a newline and after the
+// final item there must be a newline or EOF. Each argument must be a
+// pointer to a basic type or an implementation of the Scanner interface. It
+// returns the number of items successfully parsed. If that is less than the
+// number of arguments, err will report why.
func Scanln(r io.Reader, a ...interface{}) (n int, err os.Error) {
s := newScanState(r, false)
n = s.doScan(a)