Documentation ¶
Overview ¶
ex7.1 provides line and word counters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LineCounter ¶
type LineCounter struct {
// contains filtered or unexported fields
}
func (*LineCounter) N ¶
func (c *LineCounter) N() int
func (*LineCounter) String ¶
func (c *LineCounter) String() string
type WordCounter ¶
type WordCounter struct {
// contains filtered or unexported fields
}
func (*WordCounter) N ¶
func (c *WordCounter) N() int
func (*WordCounter) String ¶
func (c *WordCounter) String() string
func (*WordCounter) Write ¶
func (c *WordCounter) Write(p []byte) (n int, err error)
A !IsSpace() -> IsSpace() transition is counted as a word.
I couldn't figure out how to use bufio.ScanWords without either double-counting words split across buffer boundaries, giving incorrect intermediate counts, or doing some really awkward buffer manipulation.
Click to show internal directories.
Click to hide internal directories.