Documentation
¶
Overview ¶
Package scannerz contains functionality for scanning data, most specifically for working with bufio.Scanner. See scannerz.NewScanner.
Index ¶
- Variables
- func Head1(ctx context.Context, s string) string
- func IndentLines(ctx context.Context, s, indent string) string
- func LineCount(ctx context.Context, r io.Reader, skipEmpty bool) int
- func NewScanner(ctx context.Context, r io.Reader) *bufio.Scanner
- func TrimHead(ctx context.Context, s string, n int) string
- func VisitLines(ctx context.Context, s string, fn func(i int, line string) string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var OptScanBufLimit = datasize.NewOpt( "tuning.scan-buffer-limit", nil, datasize.MustParseString("32MB"), "Scan token buffer limit", `Maximum size of the buffer used for scanning tokens. The buffer will start small and grow as needed, but will not exceed this limit. Use units B, KB, MB, GB, etc. For example, 64KB, or 10MB. If no unit specified, bytes are assumed.`, options.TagTuning, )
OptScanBufLimit is an Opt for configuring the buffer size of a bufio.Scanner returned from scannerz.NewScanner.
Functions ¶
func IndentLines ¶
IndentLines returns a new string built from indenting each line of s.
func LineCount ¶
LineCount returns the number of lines in r. If skipEmpty is true, empty lines are skipped (a whitespace-only line is not considered empty). If r is nil or any error occurs, -1 is returned.
func NewScanner ¶
NewScanner returns a new bufio.Scanner configured via OptScanBufLimit set on ctx.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.