mirror of
https://github.com/golang/go
synced 2024-11-22 06:34:40 -07:00
fmt.Scan: custom formatters
R=rsc CC=golang-dev https://golang.org/cl/1315042
This commit is contained in:
parent
6965b407dd
commit
7ee6d44e4f
@ -181,11 +181,11 @@ func (s *ss) token() string {
|
|||||||
return s.buf.String()
|
return s.buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan parses text read from r, storing successive space-separated
|
// Scan parses text read from r, storing successive space-separated values
|
||||||
// values into successive arguments. Newlines count as space. Each
|
// into successive arguments. Newlines count as space. Each argument must
|
||||||
// argument must be a pointer to a basic type. It returns the number of
|
// be a pointer to a basic type or an implementation of the Scanner
|
||||||
// items successfully parsed. If that is less than the number of arguments,
|
// interface. It returns the number of items successfully parsed. If that
|
||||||
// err will report why.
|
// is less than the number of arguments, err will report why.
|
||||||
func Scan(r io.Reader, a ...interface{}) (n int, err os.Error) {
|
func Scan(r io.Reader, a ...interface{}) (n int, err os.Error) {
|
||||||
s := newScanState(r, true)
|
s := newScanState(r, true)
|
||||||
n = s.doScan(a)
|
n = s.doScan(a)
|
||||||
@ -194,12 +194,12 @@ func Scan(r io.Reader, a ...interface{}) (n int, err os.Error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scanln parses text read from r, storing successive space-separated
|
// Scanln parses text read from r, storing successive space-separated values
|
||||||
// values into successive arguments. Scanning stops at a newline and after
|
// into successive arguments. Scanning stops at a newline and after the
|
||||||
// the final item there must be a newline or EOF. Each argument must be a
|
// 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
|
// pointer to a basic type or an implementation of the Scanner interface. It
|
||||||
// parsed. If that is less than the number of arguments, err will report
|
// returns the number of items successfully parsed. If that is less than the
|
||||||
// why.
|
// number of arguments, err will report why.
|
||||||
func Scanln(r io.Reader, a ...interface{}) (n int, err os.Error) {
|
func Scanln(r io.Reader, a ...interface{}) (n int, err os.Error) {
|
||||||
s := newScanState(r, false)
|
s := newScanState(r, false)
|
||||||
n = s.doScan(a)
|
n = s.doScan(a)
|
||||||
|
Loading…
Reference in New Issue
Block a user